Skip to main content

I am running 10.4.1 and tried to change my ASSIGN statement to print directly to PDF.  The old statement (which opened the Windows Print Manager) was

SELECT PRINT-FILE
ASSIGN TO PRINT PRINTER-NAME
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS IS PRINTER-STATUS.

and the new is

SELECT PRINT-FILE
ASSIGN TO "-P PDF C:\\apps\\report2.pdf"
FILE STATUS IS PRINTER-STATUS.

But now many of the WIN$PRINTER calls are getting -6 and -7 errors.  Below is an example of a call which works with the Windows Print Manager but not when printing direct to file.

INITIALIZE WPRTDATA-DRAW
MOVE 17.60 TO WPRTDATA-DRAW-START-X
MOVE 02.30 TO WPRTDATA-DRAW-START-Y
MOVE WPRTUNITS-CENTIMETERS TO WPRTDATA-DRAW-UNITS
CALL "WIN$PRINTER" USING
       WINPRINT-SET-CURSOR
       WINPRINT-DATA
                 GIVING CALL-RESULT
WRITE PRINT-LINE FROM ":" BEFORE ADVANCING 1 LINE

It creates the pdf file but is empty, no doubt due to the failed WIN$PRINTER calls.  Is there something more I need to do?  And yes, I could cut everything over to C$PDF but that would be a lot of work.  thanks

I am running 10.4.1 and tried to change my ASSIGN statement to print directly to PDF.  The old statement (which opened the Windows Print Manager) was

SELECT PRINT-FILE
ASSIGN TO PRINT PRINTER-NAME
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS IS PRINTER-STATUS.

and the new is

SELECT PRINT-FILE
ASSIGN TO "-P PDF C:\\apps\\report2.pdf"
FILE STATUS IS PRINTER-STATUS.

But now many of the WIN$PRINTER calls are getting -6 and -7 errors.  Below is an example of a call which works with the Windows Print Manager but not when printing direct to file.

INITIALIZE WPRTDATA-DRAW
MOVE 17.60 TO WPRTDATA-DRAW-START-X
MOVE 02.30 TO WPRTDATA-DRAW-START-Y
MOVE WPRTUNITS-CENTIMETERS TO WPRTDATA-DRAW-UNITS
CALL "WIN$PRINTER" USING
       WINPRINT-SET-CURSOR
       WINPRINT-DATA
                 GIVING CALL-RESULT
WRITE PRINT-LINE FROM ":" BEFORE ADVANCING 1 LINE

It creates the pdf file but is empty, no doubt due to the failed WIN$PRINTER calls.  Is there something more I need to do?  And yes, I could cut everything over to C$PDF but that would be a lot of work.  thanks

'-P PDF' can not be controlled using WIN$PRINTER. There are a number of configuration options (all prefixed PDF_) that allow you to control the PDF when using '-P PDF' - https://bit.ly/3FK0nXi

You could also use C$PDF instead of '-P PDF' and WIN$PRINTER to create the PDF and have more control over its characteristics. - https://bit.ly/3rBY7w7

Thank you