Solved

printer looses alignment when printing labels (VB)

Posted on 1998-12-13
7
237 Views
Last Modified: 2008-02-20
I wrote an DOS based programme some years ago in QuickBasic, to print Names and Addresses on labels. One of my own printers was and still is an Epson EX800 which provides excellent service. The program was/is used on other DMP's and inkjets, It works fine on all types.

I am upgrading the programme to VB 4 and 5. It works fine on
inkjet printers using 'cut sheet' label pages, but has a problem on DMP's as described below.

I have a system that can boot Win3.11, Win95 or Win98. In
order to cater for some users who still have DMP,s I need
to include their use in my programme, described below.

I have tested the programme under Win 3.11, Win 95 and Win
98 in the 16 bit VB4 version, and under Win 95 and Win 98
in the 32 bit VB5 versions. I have tested it using both Epson EX800 and LQ550 printers.

Using continuous fan-fold labal paper, correctly set for 12 inch 'fold' pages, (in Printer Setup), the label row spacing is not adjusted correctly. The labels very slowly 'creep' up the page, so that after about 30 to 60 rows (3 to 10 'folds' depending on label height setting), label printing has moved 'UP' by app. one line, slowly encroaching on to previous rows.

Internally I have checked settings. With ScaleMode = 1, the
ScaleHeight seems correct at 17280 twips for 12 inch page, Label Spacing which is correct at 2880 twips (testing with 2 inch high labels).

I have tried to 'fool' the printer(s) by setting a custom page size just below or above 12 inches. I have also tried changing the internal 'ScaleHeight' value marginally.

Although some of my tests produce changes, the results are undesirable, and none of them cure the basic problem.

The 'creepage' is small, ammounting to about .1 inch in 30/40 labels, although occasionally there will be the odd place where the inter-label 'gap' will fall up to .25 inches short, and this does not occur at 'page' break' positions.

Can you suggest any remedy or point me at a solution. As it
occurs with all thre OS's I can't see that it is related to
this, and since it occurs with two different DM printers, I
cannot see that it is printer related.

It seems to be a programming problem, but I cannot see a way
to resolve it. All attempts to make the printer adjust its
position marginally after each page fails to produce the desired result.

Thanks
0
Comment
Question by:nedwob
7 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 1449765
Is your printer set to tractor feed? If you have it set to friction feed you'll get exactly the symptom you're experiencing. This is a lever adjustment at the end of the carriage. You cannot friction feed "tractor" forms accurately.

M

0
 

Author Comment

by:nedwob
ID: 1449766
Sorry I didn't say, but yes, tractor mode is used. More tests done tonight - after passing 10 - 12 inch pages through, the slippage is .2 inches as near as I can measure it - .02 inch per 'fold' and seems consistent.
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1449767
Metric paper?

M
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 2

Accepted Solution

by:
kswinney earned 200 total points
ID: 1449768
Open the port for output like this:

lPort = freefile
Open "LPT1:" for output as #lPort

Then print to it as you would in a character-based environment like this:

print #lPort, sLine$

NOTE:  Under Windows 95 and NT the behavior will vary using this method.  Under NT, you need to specifically give security rights so that your app will have access to the port.

Good luck!

kswinney.
0
 

Author Comment

by:nedwob
ID: 1449769
Thanks for the suggestion, but this would create large problems in getting the formatting right, which don't arise in the VB Printer object.

Even printing BLANK pages produces the same result ie; about .02 inch per page is not getting ejected

eg For X = 1 to 10
      printer.Newpage
   next X

ejects 10 pages, but .2 inches short on the last page.

I think it must be a driver problem, but unfortunately, no more recent drivers are available.

Since putting the question, I have evolved a work-around. Use 'Custom' page setup, and tell the printer that each page is for example 12.02 inches long instead of 12 inches.

It's a messy solution though, an shouldn't be necessary.
0
 

Expert Comment

by:lame
ID: 2846961
We have had nothing but problems with printing in VB I doubt that there is a problem with the printer drivers. We had good luck printing in WIN95 and VB4
But after upgrading cretin applications or going to VB5,6 the printing format and line spacing changed but not the code. The same VB program on NT4.0 prints totally different to our printers
We have not found any info on what is Different from printing in VB4 to VB5 or VB6 and why NT and WIN95/98 print differently. The custom page trick only worked on WIN95 and VB4 after that nothing worked right!


Public Function PrintLabels(job As String, cust As String, desc As String, thedate As String, prog As String, rev As String, num As Integer) As Boolean
'this function will print out the product labels
'and return true if ok, false if not
Dim I As Integer

On Error GoTo OpenError

For I = 1 To num
    Printer.Print Tab(25); job:
    Printer.Print Tab(2); cust:
    Printer.Print Tab(2); desc:
    Printer.Print Tab(2); thedate;
    Printer.Print Tab(15); prog;
    Printer.Print Tab(25); "REV " + rev:
    Printer.CurrentY = Printer.CurrentY + 625
Next
Printer.EndDoc
 
PrintLabels = True
 
Exit Function

OpenError:
    PrintLabels = False
    Exit Function
   
End Function


we had to add this code later as to get NT close but not the same:

Dim I As Integer, F As New StdFont

F.Name = "SIMPLEX"
F.Size = 10
F.Bold = True
Set Printer.Font = F
0
 

Author Comment

by:nedwob
ID: 2850171
to lame

Thank you for your comments. I am now using VB6, and to be honest I have only tried printing a short run of labels on the old DMP once. I am not sure if the problem is still present - I will make some tests and look at your approach.

Your approach of incrementing CurrentY between labels is worth trying - my code was incrementing it after each line

I only use the old DMP rarely, and the results are still the same, so I have to 'work around' the problem, as before.



nedwob
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now