I've recently migrated one of my company's applications from PowerBuilder 2017 R3 to PowerBuilder 2021 (Professional Edition) and we want to eliminate the need for having Ghostscript installed to export PDF files. On the PDF Export tab of the Application objects Additional Properties dialog I checked "Always use NativePDF! method for PDF Export" but the PDF files are save in 8.25" x 11.7" (approx.) instead of 8.5" x 11". The DataWindows are all defined as "Letter 8 1/2 in x 11 in" so I don't know why this is happening. I've looked in the Community for an answer but didn't find anything helpful.
- You are here:
- Home
- Q&A
- Q&A
- PowerBuilder
- Saving PDF using NativePDF! creates wrong size pages
- Daniel Kervabon
- PowerBuilder
- Thursday, 3 March 2022 18:05 PM UTC
- Thursday, 3 March 2022 18:47 PM UTC
- PowerBuilder
- # Permalink
Armeen is correct. The default paper size for the NativePDF driver is A4.
You might want to consider using the UsePrintSpec option:
When we switched our commercial application to use NativePDF instead of GhostScript, we made some changes to our ancestor DW control to properly configure the various Export.Data.NativePDF.xxxx options automatically. Something you might wish to consider.
Regards, John
- Thursday, 3 March 2022 18:11 PM UTC
- PowerBuilder
- # 1
Did you set the paper size for the PDF: dw_1.Object.DataWindow.Print.Paper.Size = 1
Here is the relevant documentation: https://docs.appeon.com/pb2021/pbug/ug16818.html#Saving_as_PDF_using_PDFlib
- Daniel Vivier
- Thursday, 3 March 2022 18:44 PM UTC
-
Helpful Loading... Helpful 1
- Roland Smith
- Thursday, 3 March 2022 19:25 PM UTC
-
Helpful Loading... Helpful 0
- Roland Smith
- Thursday, 3 March 2022 19:27 PM UTC
-
Helpful Loading... Helpful 0
- Thursday, 3 March 2022 18:36 PM UTC
- PowerBuilder
- # 2
Hello Armeen, thanks for the quick response.
In the DataWindows we have the Paper Size set as shown here. Do we need to do more than that?
We have over a hundred reports in one of our applications and I would hate to have add code for each one.
Daniel
- Armeen Mazda @Appeon
- Thursday, 3 March 2022 18:56 PM UTC
-
Helpful Loading... Helpful 1
- Ronnie Po
- Thursday, 3 March 2022 18:58 PM UTC
dw_control.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec='Yes'
If the value = 'Yes', then the export process will use the values specified in the DW painter. (I don't know why the two sets of paper sizes weren't integrated behind the scenes to keep things seamless to the developer).
If 'No', then the export process will use the value of the property
dw_control.Object.DataWindow.Export.PDF.NativePDF.CustomSize
The values for CustomSize are different from the traditional values in the DW painter. The default paper size is also different.
-
Helpful Loading... Helpful 3
- Chris Pollach @Appeon
- Thursday, 3 March 2022 19:55 PM UTC
Yes, that's the key one IMHO ...
dw_control.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec='Yes'
Regards ... Chris
-
Helpful Loading... Helpful 1
- Thursday, 3 March 2022 23:22 PM UTC
- PowerBuilder
- # 3
Thanks to all of you for your help. It works now by setting dw_1.Object.DataWindow.Print.Paper.Size = 1
I don't need to do something for every report as we have a report viewer window.
There is also other valuable information found in the links provided by John Fauss.
- Page :
- 1
However, you are not allowed to reply to this question.