|
-
Oct 25th, 2006, 01:53 PM
#1
Thread Starter
Fanatic Member
Dot Matrix Printing
I have written an application that prints to dot matrix printers for my client. The problem I am having is that on multi-page jobs, the first page lines up fine, but every subsequent page is one line lower. It doesn't keep creeping down the page, it just does this one time after the first page is printed.
This is mostly acceptable for reports, but for printing on pre-printed forms, it becomes a pain.
I searched all over the place and haven't seen any ideas that seem to be able to fix this issue. Hopefully, someone here has run into this in the past and can point me in the right direction. The printers are Okidata 320s and 321s and some Turbo models.
I have checked all through my code and there doesn't appear to be anything in the code that is causing the issue. It appears that it has something to do with the printer. I have adjusted settings until my fingers hurt and nothing has worked, yet.
The printer knows where the top of the form is and has the correct paper length set, because if I set TOF and then print a one-page report, it is down one line too many when it has finished form feeding. If I press the Form Feed button on the printer, then it page ejects to the correct position of the next page. It's almost as if there is a Line Feed coming from somewhere. However, I don't have any different code for printing the first page than I have for printing any other page. It is the exact same code.
I thought the problem might be coming from some of the ESC characters that I am sending to the printer, so I commented them out and it still does it.
PS - To be able to send the reports directly to the printer, my application actually writes the reports out to a text file and then calls the SendFileToPrinter routine found here http://support.microsoft.com/kb/322090.
PSS - I am using the Generic/Text Only driver in Windows XP. I have also tried the Epson FX-286 driver and the Okidata driver.
My.Settings.Signature = String.Empty
-
Oct 25th, 2006, 02:29 PM
#2
Re: Dot Matrix Printing
Can you post the text file?
-
Oct 25th, 2006, 03:17 PM
#3
Thread Starter
Fanatic Member
Re: Dot Matrix Printing
Let me scrub the data and I will post one.
My.Settings.Signature = String.Empty
-
Oct 25th, 2006, 03:43 PM
#4
Re: Dot Matrix Printing
Back in our mainframe days we made sure to put all the escape seq's that were at print start on the same line as the first print...
Show the code you use to start the TEXT file and what code you use to eject to a new page in the TEXT file.
-
Oct 25th, 2006, 03:54 PM
#5
Thread Starter
Fanatic Member
Re: Dot Matrix Printing
Here are the commands that I am using for the EpsonFX emulation:
VB Code:
' Determine which escape codes to send printer
' Initialize the printer and set to Epson FX Emulation
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(64))
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(123) & Chr(65))
Select Case _CPI
Case CharactersPerInch.Pica10
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(18)) ' Cancel Compressed Print
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(80)) ' 10 CPI
Case CharactersPerInch.Pica12
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(18)) ' Cancel Compressed Print
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(77)) ' 12 CPI
Case CharactersPerInch.Pica15
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(18)) ' Cancel Compressed Print
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(103)) ' 15 CPI
Case CharactersPerInch.Pica17
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(15)) ' Select Compressed Print
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(80)) ' 10 CPI
Case CharactersPerInch.Pica20
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(15)) ' Select Compressed Print
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(77)) ' 12 CPI
End Select
Select Case _PrintQuality
Case PrintQuality.HSD
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(40) & Chr(48)) ' SSD/HSD
Case PrintQuality.NLQ
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(120) & Chr(49)) ' NLQ
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(107) & Chr(1)) ' NLQ
Case PrintQuality.UTL
rph.SendStringToPrinter(_pDoc.PrinterSettings.PrinterName, Chr(27) & Chr(120) & Chr(0)) ' UTL
End Select
This is the code I am using for a Form Feed
VB Code:
PrintLine(FileNumber, Chr(12))
After much fighting with this printer, I switched over to using IBM ProPrinter emulation and that doesn't seem to cause the creep. No telling what it may break down the road, though. I really hate to change the central printing routine for this app that is in production without a ton of additional testing of the many reports.
If you see something in that code, let me know.
My.Settings.Signature = String.Empty
-
Oct 25th, 2006, 04:06 PM
#6
Re: Dot Matrix Printing
The problem you are having is not foreign to me - I remember having issues with EPSON printers...
At any rate, I look at the HELP for PRINTLINE in .Net and see that in the REMARKS it says that PRINTLINE does include a linefeed, while PRINT does not include a linefeed at the end of the line.
-
Oct 25th, 2006, 04:14 PM
#7
Thread Starter
Fanatic Member
Re: Dot Matrix Printing
I tried using the PRINT command, but noticed that it didn't write anything into the text file. I wanted to try that to see if it was putting in the extra line feed that was causing the problem.
On a side note about the PRINTLINE vs PRINT, it would seem to me that if the extra line feed was causing the problem that it would happen on every page, not just the first page like is happening here.
My.Settings.Signature = String.Empty
-
Oct 25th, 2006, 04:18 PM
#8
Re: Dot Matrix Printing
We used to fudge first-page printing for things like tax forms to get around issues like this...
Do you need to print on the physical first line of the page? It would be a hack, but an easy hack to print an extra blank line on page one to get around this...
-
Oct 26th, 2006, 08:04 AM
#9
Thread Starter
Fanatic Member
Re: Dot Matrix Printing
I was thinking about doing something similiar. Now that I have the IBM ProPrinter emulation working, I think I am going to step away from this for a while and finish some other modules of this app. Like finish the mechanism to allow for closing the month since it is almost the end of the month.
My.Settings.Signature = String.Empty
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|