1. Hugo Moors
  2. PowerBuilder
  3. Monday, 27 March 2023 12:06 PM UTC

I may be missing something obvious but I have a DW (with some nested reports)

I retrieve, set the properties

dw_invoice.Object.DataWindow.Print.Paper.Size = 9 // A4
dw_invoice.Object.DataWindow.Print.Orientation = 2 // portrait

When I retrieve/display the DW it's 1 page (I have a computed field for pages and it reports the number of correct pages)

But when doing a saveas("filename.pdf",PDF!,False) I get a PDF with 2 pages (the last row and footer is on the next page, while on the window there is only 1 page). I'm using NativePDF!

dw_invoice.Object.DataWindow.Export.PDF.Method = NativePDF!

I'm not changing margins, just saveas.

(also the resulting PDF is letter format not A4! but that would not be a problem if it reported the pages correctly)

 (PB V2022 IDE 1892 Runtime 1878)

Accepted Answer
Hugo Moors Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2023 15:02 PM UTC
  2. PowerBuilder
  3. # Permalink
After changing the font from Nexa to Verdana the display issue and double page issue seems to be fixed. I'll have to see with the client if changing the font for that part of their invoices is an option.
Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 28 March 2023 16:07 PM UTC
Thanks for sharing the solution!
  1. Helpful 1
  1. Sivaprakash BKR
  2. Wednesday, 29 March 2023 06:36 AM UTC
Nice to hear that and thanks for sharing the solution. So, some issue in rendering some fonts in native pdf.
  1. Helpful
  1. Hugo Moors
  2. Wednesday, 29 March 2023 07:15 AM UTC
@Sivaprakash sort of, when displaying the DW in print preview (IDE or in application) some fonts seem to be rendered wrong resulting in a pdf that is different from the print preview, in my case I noticed it because of the page difference. With another font print preview and pdf appear equal.
  1. Helpful
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Monday, 27 March 2023 13:29 PM UTC
  2. PowerBuilder
  3. # 1

Hi,

are there any controls that are wider than the page width? Try setting a visible border for all controls and saving again, that might reveal the culprit.

Comment
  1. Hugo Moors
  2. Tuesday, 28 March 2023 14:04 PM UTC
Nothing is wider, in the application the datawindow (in print preview mode) shows a clean single page.



But saveas pdf results in a 2 page PDF.

  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 27 March 2023 14:30 PM UTC
  2. PowerBuilder
  3. # 2

Hi, Hugo - 

Try enabling the UsePrintSpec property:

dw_1.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec='yes'

This tells NativePDF to use the page orientation and paper size settings in the Print Specifications tab of the DataWindow. The default value is 'no'.

Best regards, John

Comment
  1. Hugo Moors
  2. Tuesday, 28 March 2023 07:27 AM UTC
Makes no difference Yes or No



  1. Helpful
There are no comments made yet.
Hugo Moors Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2023 08:00 AM UTC
  2. PowerBuilder
  3. # 3

I tried John's suggestion

dw_invoice_pdf.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec = 'Yes'

Doesn't make a difference Yes or No

EDIT: This does not seem to matter, the resulting PDF has A4 sizes

Also the datawindow is configured like this

Print specs of the DW are like this

I changed the default printer to a printer that has every setting as A4 with dw_invoice_pdf.Modify( 'DataWindow.Print.PrinterName = "xxx") verified with a Describe of that setting, also set NativePDF.CustomSize to 4 (A4)

Nothing seems to result in an A4 PDF

 

 

 

 

Comment
  1. Hugo Moors
  2. Tuesday, 28 March 2023 12:06 PM UTC
I'm also getting this in the PB IDE, Preview gives 1 page, Save Rows As... PDF gives a 2 page PDF in Letter format
  1. Helpful
There are no comments made yet.
Hugo Moors Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2023 12:17 PM UTC
  2. PowerBuilder
  3. # 4

I've removed my previous reply as the resulting PDF is indeed A4 (the 0.00x difference in size seems normal and is not Letter format)

It remains that I have a situation where in the PB IDE (2022, build 1892, runtime 1878) I have a DW in print preview that is 1 page but when I saveas PDF it becomes 2 pages.

Printing this report with Microsoft Print to PDF results in a PDF with 1 page

Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2023 13:29 PM UTC
  2. PowerBuilder
  3. # 5

Can you try printing the same using Microsoft Print to PDF and / or CutePDF ?

If  the above printers prints correctly, then the issue might be with NativePDF. 

Happiness Always
BKR Sivaprakash

 

Comment
  1. Sivaprakash BKR
  2. Tuesday, 28 March 2023 13:34 PM UTC
With PB 2019R3



The other option could be to try printing from another computer.



Using NativePDF

IN development machine the report was correct (1 page), but we got 2 pages in Cient's machine.



Using CutePDF

The same report was correctly printing in both development and client's machine.

  1. Helpful 1
  1. Hugo Moors
  2. Tuesday, 28 March 2023 13:54 PM UTC
I can't use a printer, I need to do this inside PB, the application has no user interaction and creates thousands of PDF every month with specific names and in specific locations.
  1. Helpful
  1. Hugo Moors
  2. Tuesday, 28 March 2023 13:57 PM UTC
Indeed if I use Microsoft Print to PDF to print from the PowerBuilder IDE I get the correct result, just SaveAs PDF doesn't do it right

  1. Helpful
There are no comments made yet.
Hugo Moors Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2023 14:43 PM UTC
  2. PowerBuilder
  3. # 6

Between the PDF and what is in the Print Preview I do see a difference:

this is in Print Preview (I have to redact a lot as GDPR has become very important at this company)

The yellow part is the top of text and the next row is visible on the same page

this is in the PDF, the yellow part is fully visible but the next row is on the next page

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.