1. Pierre DETE
  2. PowerBuilder
  3. Tuesday, 5 April 2022 15:44 PM UTC

Hello,

I have a different behavior when I print with NativePDF a portrait output between IDE and deployed.

When I run from the IDE the output is fine in portrait, but when I run from a deployed application the layout is smaller, not in full page, like in landscape.

I don't know how to handle it.

I have a pb.ini file into my app directory.

[Data Window]
NativePDF_Valid=1
NativePDF_IncludeCustomFont=1

Just before printing I set :

dw.Modify ("DataWindow.Export.PDF.Method = NativePDF!")
dw.Modify ("DataWindow.Export.PDF.NativePDF.PDFStandard = 1")

The default output is set to Microsoft Print to PDF + Portrait.

What should I check?

Thank you in advance.

Pierre

 

 

 

 

 

 

 

Pierre DETE Accepted Answer Pending Moderation
  1. Wednesday, 6 April 2022 12:25 PM UTC
  2. PowerBuilder
  3. # 1

Hi Mark,

Here is the final version :

dw.Object.DataWindow.Export.PDF.Method = NativePDF!
dw.Object.DataWindow.Export.PDF.NativePDF.ImageFormat = 1
dw.Object.DataWindow.Export.PDF.NativePDF.PDFStandard = 1
dw.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec = 'No'
// Runtime issue,  which set CustomOrientation to 1, must be set to 0
dw.Object.DataWindow.Export.PDF.NativePDF.CustomOrientation = 0
dw.Object.DataWindow.Export.PDF.NativePDF.CustomSize = 0
//

The NativePDF.UsePrintSpec is not the problem even it is set to 'No', in my case I have to force CustomOrientation to 0 because it is set to 1 at runtime.

Maybe there is an issue with PB because we never set this value to 1 into the code, and it's not reproduced with the IDE.

Pierre

Comment
  1. Mark Lee @Appeon
  2. Thursday, 7 April 2022 04:53 AM UTC
Hi Pierre,



Please refer to PB help documentation.

CustomOrientation setting to 0 means the orientation which is set in the Print Specification page in the DataWindow object's Properties view.

You can check the following link for details

https://docs.appeon.com/pb2021/datawindow_reference/XREF_36021_Alphabetical_list.html#XREF_65778_Export_PDF_NativePDF_CustomOrientation



I suggest that you set this CustomOrientation in your code.



BTW, if you suspect that this is a PB issue and If you can reproduce it, kindly please report this issue to our ticket system: https://www.appeon.com/standardsupport/newbug so that it can be properly received and tracked.

Please also provide a sample PB test case (with PBT / PBL) when you submit it to the ticket system.



Regards,

  1. Helpful
There are no comments made yet.
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 6 April 2022 09:52 AM UTC
  2. PowerBuilder
  3. # 2

Hi Pierre,

 

It looks like your issue is whether the UsePrintSpec property is enabled.
After you upgrade PowerBuilder and if you want to replace GhostScript with NativePDF, I suggest that you enable this setting, which requires minimal changes to your code.
If you want to make sure the exported PDF paper size is the same as DataWindow Print when using NativePDF, I suggest that you enable this setting.

You can refer to the following KB for more information in this area:
https://www.appeon.com/developers/get-help/knowledgebase/paper-size-pdf-exported-nativepdf-differs-ghostscript.html

BTW, please also refer to the PB documentation:
https://docs.appeon.com/pb2021/whats_new/ch03s01s09.html
The two INI settings NativePDF_IncludeCustomFont and NativePDF_Valid no longer take effect from PB 2019 R2.

Here is the replacement solution:
https://docs.appeon.com/pb2021/pbug/ug16818.html#Saving_as_PDF_using_PDFlib

 

Regards,

Comment
There are no comments made yet.
Pierre DETE Accepted Answer Pending Moderation
  1. Tuesday, 5 April 2022 18:19 PM UTC
  2. PowerBuilder
  3. # 3

Hello John,

 

I just notice that dw.Object.DataWindow.Export.PDF.NativePDF.CustomOrientation is set to 1 at runtime, instead of 0 with IDE. 

 

Here are all my settings :

 

// KTP-17720 : Portrait/Landscape Issue -> Choose "Microsoft Print to PDF"+Portrait
dw.Object.DataWindow.Export.PDF.Method = NativePDF!
dw.Object.DataWindow.Export.PDF.NativePDF.ImageFormat = 1
dw.Object.DataWindow.Export.PDF.NativePDF.PDFStandard = 1

// Runtime difference, must be set to 0
dw.Object.DataWindow.Export.PDF.NativePDF.CustomOrientation = 0
dw.Object.DataWindow.Export.PDF.NativePDF.CustomSize = 0

 

With the setting of custom values to 0, the result seems OK, both with IDE and Runtime.

I don't understand the purpose of these two custom values.

 

 

Should I set dw.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec to no ?

 

Pierre

 

 

Comment
  1. John Fauss
  2. Tuesday, 5 April 2022 20:33 PM UTC
Personally, I always set the UsePrintSpec property to Yes. In that way, whatever values the developer has specified in a DataWindow object is what gets used at runtime. What you choose to do is up to you, of course.

I can't speak to the purpose of the NativePDF "custom" settings, but you need to understand that they exist and how they (as well as all of the other NativePDF settings) can affect your application(s).
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 5 April 2022 17:47 PM UTC
  2. PowerBuilder
  3. # 4

Hi, Pierre -

DataWindow.Export.PDF.NativePDF.CustomSize = '0' means default paper size, which is A4.

DataWindow.Export.PDF.NativePDF.CustomOrientation = '0' means the orientation that is set in the DataWindow object's Print Specification tab.

Print.Paper.Size = 0 means default paper size for the printer, but this setting doesn't matter because NativePDF.CustomSize is set to zero.

Print.Orientation = 0 means the default orientation for the printer, which is what will be used since NativePDF.CustomOrientation is set to zero.

Do you use/set the Export.PDF.NativePDF.UsePrintSpec setting?

When set to Yes, this tells PB to use the settings in the DataWindow's Print Specifications page or in the Print.Orientation and Print.Paper.Size properties instead of the NativePDF.CustomSize and NativePDF.CustomOrientation properties. Not using this setting might be the cause of your issue.

Best regards, John

Comment
There are no comments made yet.
Pierre DETE Accepted Answer Pending Moderation
  1. Tuesday, 5 April 2022 16:53 PM UTC
  2. PowerBuilder
  3. # 5

Yes Sorry ! With the IDE :

dw.Object.DataWindow.Print.Orientation = 0

dw.Object.DataWindow.Export.PDF.NativePDF.CustomOrientation = 0

dw.Object.DataWindow.Print.Paper.Size = 9

dw.Object.DataWindow.Export.PDF.NativePDF.CustomSize = 0

and

PB2019 R2 

Is there a way to export all the properties to check if one has changed with the runtime ? 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 5 April 2022 16:29 PM UTC
  2. PowerBuilder
  3. # 6

Also, in the DataWindow object's Print Specification tab, what is the value of the following properties:

  • Paper Orientation
  • Paper Size
Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 5 April 2022 15:57 PM UTC
  2. PowerBuilder
  3. # 7

Hi Pierre;

  What version & build of the PB IDE/Runtime are you using?

Regards ... Chris

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.