Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer page length problems

Status
Not open for further replies.

aharrisreid

Programmer
Nov 17, 2000
312
0
0
GB
I have taken-over an 'old' FoxPro DOS application which I have updated to run under VFP7, but still uses hand-coded reports which start...

SET DEVICE TO PRINT
SET PRINTER TO NAME "INVOICE1"
SET PRINTER FONT 'COURIER NEW',11
??? CHR(27)+'x0' && draft
??? CHR(27)+'@' && reset printer
_pagelen=66

@1,1 SAY ...
@2,3 SAY ...
and so on...

EJECT

---------------------------

All reports are to be printed on 3-part continuous fan-fold paper with a page length of exactly 11 inches. The printer is a EPSON LQ300 dot-matrix printer.

Some pages are ejecting on 62 lines, some on 68 - there is no consistency which I can pinpoint. At present it is a pain for the user to only print one invoice or one statement at a time, resetting the paper loader, printing another invoice, etc.. This defeats the whole idea of using continuous paper!

For the printer commands that do not have Foxpro commands (eg. set bold on/off) ??? commands are used. Could it be the mixture of Foxpro (eg. _pLength) and ??? commands that is causing the problems? Is it ok to use _plength outside of a PRINTJOB/ENDPRINTJOB (I have not used these latter commands)? Should I always use ??? commands in preference to _plength, eject, etc.?

BTW, the printer manual states that the escape code for setting page length is ESC Cn, where n is the no. of lines per page. Does this mean the sequence in Fox is CHR(27)+'C'+CHR(66), or CHR(27)+'C66'?

I could send all reports to a text file using SET DEVICE TO printfile.txt, then print the file using TYPE printfile.txt TO PRINT, but is it any easier to control the page length this way?

This DOS-style printing is becoming a headache, so any advice would be appreciated. I've already suggested redesigning the reports in VFP, but the budget will not stretch that far.


Alan Harris-Reid
 
Alan,

I suspect that this is caused by slight variations in the height of the print lines introduced by the printer driver.

A couple of quick things to try:

- Use a printer-resident font, such as Courier, rather than Courier New.

- Make sure you are using the generic/text only driver.

Also, you are probably right to suspect the fact that you are mixing ??? and _pXXX settings. My preference would be to stick with ??? and to dispense with PRINTJOB. And maybe use ??? CHR(12) instead of EJECT.

Re CHR(27)+'C'+CHR(66), or CHR(27)+'C66' ... well, it's one or other of those. Why not just send each one in turn from the command window, followed by a CHR(12). That should tell you which one works.

Sorry I can't be more definite. If you come with any more information, let me know.

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Re : page length settings

The correct coding is

??? chr(27)+"C"+chr(66)

Good luck
 
Mike, thanks for the reply.

>- Use a printer-resident font, such as Courier, rather >than Courier New.

I tried SET PRINTER FONT 'COURIER',11, but the printer output a totally different (proportional) font. Changing to 'COURIER NEW' got the font right. Maybe I'll have to program 'Courier' via a ??? command.

BTW, do you think the size command 11 could be causing the problem? When I omitted it I got 14 point!

>Sorry I can't be more definite.

Don't worry - any help is good at this stage.

Regards,
Alan
 
peterasf,

>??? chr(27)+"C"+chr(66)

Thanks for the reply. I'll make sure all settings follow this format.

BTW, does the length corresponding to 66 lines-per-page depend on the font used? Would it be safer to program for 11 inches rather than 66 lines? The printer says the sequence is ESC C 0 n (where n is the no. of inches/page). In Foxpro is the command ??? CHR(27)+'C0'+CHR(11)?

Many thanks,
Alan


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top