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!

AcuCobol Printer Pitch configuration

Status
Not open for further replies.

fugitivo

Programmer
Feb 4, 2003
5
0
0
AU
Hi,

I'm new with AcuCobol and windows. I'm currently using AcuCobol Version 4.0 on windowsXP.

I'd like to print 132 chars per line in my new laser printer.
How can I change the printer pitch via the configuration
file?. Or perhaps filter the print-output to a file?. (Or
any idea to preserve the ouput?).

Can you help?. Thank you in advance!.

--Fugitivo
 

Here is a routine that works for setting up a laser printer in Acucobol. The first call sets up a default font; The second call gets the current setting so they can be reset if necessary; The third call sets the font to compressed print so you can print 132 columns; The last two calls sets the margins and the lines per page. Hope this helps.


Ted

======================================================


9991-set-windows-printer.

move wprtfont-default to wprtdata-font.
call "win$printer" using winprint-setup
winprint-data
giving result.
if result not = 1
exit paragraph
end-if


move "-p spooler" to PRINTER-NAME.

MOVE "OPEN" TO FILE-ERROR-TYPE.
MOVE OPEN-ERROR TO VALID-ERROR-1.
OPEN OUTPUT PRINTOUT-FILE WITH NO REWIND.
set printer-open to true
call "win$printer" using winprint-get-page-layout,
winprint-data
giving result.
if result not = 1
exit paragraph
end-if

initialize win-printer-setting.
call "win$printer" using winprint-get-settings
win-printer-setting
giving win-print-result.

move wprtfont-courier-12-comp to wprtdata-std-font.
call "win$printer" using winprint-set-std-font
winprint-data
giving result.
if result not = 1
exit paragraph
end-if

initialize wprtdata-margins
move 0.5 to wprtdata-top-margin
move 0.5 to wprtdata-bottom-margin
move 0.5 to wprtdata-right-margin
move 0.5 to wprtdata-left-margin.
move wprtmargin-inches to wprtdata-margin-units
call "win$printer" using winprint-set-margins
winprint-data
giving result.
if result not = 1
exit paragraph
end-if

move 60 to wprtdata-lines-per-page
call "win$printer" using winprint-set-lines-per-page
winprint-data
giving result.
if result not = 1
exit paragraph
end-if.

9991-exit. exit.
 
Sorry, I failed to mention that you need to copy "winprint.def" into your working storage section. This file is supplied by Acucorp on the installation disk.


Ted

 
Ted95242,

Thank you for your code + suggestions it's great the way you responded it. Except I didn't made myself clear, I'm dealing with legacy cobol and I've got the impression that I don't possess the right source. So I thought somehow to control de printer via the Cobol config file.A runtime setting like DEFAULT-FONT SMALL or something similar. Or redirect the spooler to EDIT ( PRINTER1 -P EDIT - this I just made it up, It works with linux by sending to the editor 'vi').

If I don't find any other way to solve this issue then I'll
used your suggestion. Thank you again!.

--fugitivo
 
You can control printers using the PRINTER entries in the cobol configuration file. These are unix examples, but the -o commands may be useful.


PRINTER1 -P lp -dfct_minolta -otl66 -olpi8 -otm0 -obm0 -olm5 -o13 -onb -oland -s

-otl66 (66lpp)
-olpi8 (8lpi)
-otm0 (zero top margin)
-obm0 (zero bottom margin)
-olm5 (5 left margin)
-o13 (13cpi)
-onb (unix no banner)
-oland (landscape)
-s (unix no message)


 
Just a note: you probably shouldn't copy winprint.def into your source. It's designed as, and should be used as, a copy book (e.g. COPY "winprint.def"). That way, if AcuCorp publishes a new version of winprint.def either due to a version upgrade or a patch, you simply have to recompile to get the latest and greatest version. This approach holds true for any of the AcuCorp supplied copybooks.

Regards.

Glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top