Highlighted
Absent Member.
Absent Member.
864 views

[archive] PDF formatting

[Migrated content. Thread originally posted on 27 November 2007]

I am preparing some statements using AcuCobol. In these pages different fonts and colors are used for emphasis.

When these pages are sent to the printer via "-P SPOOLER" the formats print out just fine.

Because of the volume we print, I am trying to print the pages to a file and then pass them through a PDF program such as CutePDF to make it easier to recover in the event of a paper jam and also for later printing.

However, when I print directly to a file, all the page formatting appears to be lost, making the PDF job a wasted exercise.

Has anyone come across this problem before and would they be able to help me with a solution.

I would appreciate any assistance I can get in solving my problem.

Thanks

Geoff Hashman
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] PDF formatting

The page formatting probably messes up because the pdf driver has a different page format. It may for instance be set to letter while your printerdriver uses A4?

If you want to complete a print and then just push it to the same printer afterwards, it is probably a better idea to use the native printer driver, but go the way around a disk file first. You can achieve this by setting the configuration variable WIN-SPOOLER-PORT.
Ex:

*Assuming filename to printfile is -P SPOOLER
SET ENVIRONMENT "WIN-SPOOLER-PORT" TO "C:\tmp\myprint.prn"
OPEN OUTPUT printfile.
*Do the print
CLOSE printfile.


At this point, you will have a file "C:\tmp\myprint.prn" rather than a load of documents in the printer tray.
This file is a perfect formatting of what you printer expects. You may now for instance open this file as binary and print it using -P SPOOLER-DIRECT as the filename and WITH NO CONTROL to the write statements.
Or you can as well from the console do COPY "C:\tmp\myprint.prn" LPT1: /B(assuming your printer is assigned to LPT1 as well).

The one and only thing to remember, is that the content of "C:\tmp\myprint.prn" is strictly formatted to the printer which driver you used to create it. If this were a HP printer it will for instance contain PCL instructions of some version. This would for instance not do good with a postscript printer...
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] PDF formatting

If you get the programmable version of Cutepdf, you will be able to direct your printer output to a .pdf file uing the Cutepdf driver itself. We use this for statements and other forms. This works perfectly.
Also then opens up possibility to then email statments as well.

Keith
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] PDF formatting

Thank you all very much for your responses and they will be helpful to me in resolving my problem.

I do apologise however for perhaps misdiagnosing my problem - to a degree.

I have no problem printing to A4 pages or in writing pages to a file fro processing via CutePDF.

My problem relates more to page content. I am enclosing a sample of the code below:

Part 1
INITIALIZE WFONT-DATA.
SET WFDEVICE-WIN-PRINTER TO TRUE.
MOVE "Courier New" TO WFONT-NAME.
SET WFCHARSET-DONT-CARE TO TRUE.
MOVE 20 TO WFONT-SIZE.
MOVE 1 TO WFONT-BOLD-STATE.
MOVE 0 TO WFONT-ITALIC-STATE,
WFONT-UNDERLINE-STATE, WFONT-STRIKEOUT-STATE,
WFONT-PITCH-STATE, WFONT-FAMILY.
CALL 'W$FONT' USING WFONT-GET-FONT, FONT-C20B, WFONT-DATA,
GIVING WFONT-STATUS.
IF WFONT-STATUS NOT = 1, STOP "FONT ERROR",
GO TO EXIT-PROGRAM.
*
*
*
Part 2
*** CHANGE FONT SIZE TO 20 BOLD ***
INITIALIZE WINPRINT-DATA.
MOVE FONT-C20B TO WPRTDATA-FONT.
CALL 'WIN$PRINTER' USING WINPRINT-SET-FONT, WINPRINT-DATA,
GIVING SAVE-RESULT.
*** WAS 7 BEFORE RE-ADDING THE LOGO, ETC.. ***
WRITE PRTREC5 FROM LINESTATE AFTER ADVANCING 12 LINES.


The first passage of code sets up the font as Courier New at 20 point Bold, with the second section of code printing the line using the font at 20 point Bold.

When I print direct to "-P SPOOLER" it prints out in Courier New - 20 point Bold.

If I write this to a file for later printing, it prints in normal font and not as Courier New - 20 point Bold.

This applies to all font formatting on the page, but only when writing to a file.

If I open this file in CutePDF to create a PDF file, the file is created with no formats applied.

Each month we create about 6000 statements and currently we scan them via a hig-speed scanner for storage should a customer require a duplicate copy. This of course requires a lot more time and my thinking behind this was that if I could first write to a PDF, we could print the statements at a more manageable rate and eliminate the need for storing them as scanned records.
Further to this, we would be able to print individual statements on request as and when the need arose.

From my tests so far, I have succeeded in creating files for processing via CutePDF. Alas! it has no print formatting.

In hindsight, perhaps I should have thought as to how better to describe my problem, rather than going off at a tangent.

Many thanks for your patience and assistance which is greatly appreciated.

Geoffrey Hashman
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] PDF formatting

We print statements and invoices via cutepfd for exactly the same reason as you describe - storage for reprinting later - also to allow for emailing of these items on production.

I attach some examples of the code we use that might help you - it works perfectly with cutepdf.

Keith
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] PDF formatting

Hi

Is it possible to control the page breaks in pdf document when we create pdfs with cutepdf? I have to print different page headers on different pages, I mean all the page headers are not same.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] PDF formatting

It works as a standard type of printer driver. If you print before page, then that is what it will do. You can then print whatever header or bitmap for the header that you wish.
Keith
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] PDF formatting

Firstly, thank you to everyone who has provided me with helpful pointers in solving my problem. Eac bit of information was helpful in provoking my thought pattern in different, yet relevant directions.

Although I have over thirty years exeprience in COBOL - albeit in a mainframe environment, this was a new experience - or rather, lack of - in a Windows environment.

I got down to examining each line of the program in writing the statements. There were three reports being produced, two without any print formatting and the third one - the statements - with print formatting.

It appears that the "unformatted" reports were overriding the print format setting for the statements. I change the order by printing the statements first and the remaining reports after the statements. When I next ran the job and selected CutePDF as my printer, lo! and behold, the page was produced with all the formatting in all its glory.

Once again, thank you all for your patience and advice.

Geoffrey Hashman
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.