Bug 4856

NativePDF loses page margins 02 April, 2021

Valdas Vaitiekaitis
26 June, 2020
Product: PowerBuilder Category: DataWindow
Version: 2019 R2 Build: 2328
Classification: Appeon bug Publishing: Public
Priority: P3
Status: Verifying Reason:
Communication Status: Waiting for Appeon
Mark Lee @Appeon 02 April, 2021
#21
Hi Miky,

Thanks for your providing the new test case.
We are working on it and we will get back to you after analyzing it.
We'll keep you posted here!

Regards,
Mark Lee
Mikulas Klasovsky 30 March, 2021
#20
PBNativePDFIssue210330.zip (77KB)

Hi,
sorry for the delay again

looks like i sent you wrong zip file originaly. i hope the attached one now will be of more help to you with a reproducible test case (with PBT/PBL). i was able to replicate on multiple machines.

steps ar the same:
1. select "Microsoft Print To PDF" printer in the top dropdown and hit "Print" button to print the PDF (my resulting pdf - 01_MSPrintToPDF.pdf)
2. hit "SaveAs Native" button to save using NativePDF Method (02_NativePDF_afterMSprintToPDF.pdf)
3. select "OneNote (Desktop)" printer and hit "Print" button (no need to actually save in one note)
4. hit "SaveAs Native" button to save using NativePDF Method (04_NativePDF_afterOneNoteDesktop.pdf)

as to your points in message #19

1. you can check the code for SaveAs Native button, but it is what you stated
 
2.  I set 'Microsoft XPS Document Writer'  to be the default printer to make sure -  the issue persists.
 
3. I tried with Ghostscript and the outcome was ok - without this issue - I added save as button for distill , so if you have Ghostscript installed you can try the same steps with use of  'SaveAs Distill' button instead of 'SaveAs Native' button
 
 hope this helps

thanks

miky
Mark Lee @Appeon 17 March, 2021
#19
Hi Miky,

Sorry for the late reply.
1. Please make sure your export relating code is as below:
dw_1.Object.DataWindow.Export.PDF.Method = NativePDF!
dw_1.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec = 'Yes'
li_print = dw_1.SaveAs('',PDF!,true)
 
2.  Please make sure that the current Windows default printer is the virtual machine printer (such as Microsoft XPS Document Writer) before your PB app runs and when exporting PDF files and then try again to see if the issue persists.
 
3. If you export the PDF file using other tools, will it have the same issue?
 
BTW, I suggest that you provide a reproducible test case (with PBT/PBL) for us to reproduce it.
 
The current NativePDF feature does not support the margins very well, so please try to avoid using the property settings.

Regards,
Mark Lee
Mikulas Klasovsky 16 February, 2021
#18
NativePDFIssue_RightMargin.zip (52KB)

Hi Mark,

sorry for delayed reply (quite bussy lately)
 
I downloaded and installed your new PowerBuilder 2019 R3 GA (build 2670) (see attached png) and used the same application (migrated to the new build) and the same steps i listed in message #13.
Unfortunatelly, I end up with the same result as with older build. (see attached pdf)

so unfortunatelly  have to report no change and that issue persists

thanks
miky

ps: i can send you the pb workspace if you want, but i used exactly the same as i sent you before, to make sure i use the same code.
Mark Lee @Appeon 24 January, 2021
#17
Hi miky,

Good news that PowerBuilder 2019 R3 GA (build 2670) is available for download. The issue you reported has been fixed in this release. Please download and install it to verify the issue you reported and let us know if any problems. You can get the installer from our Downloads portal at https://account.appeon.com/download/2019 (login required).
 
We welcome all feedback from you!
 
Regards,
Mark Lee
Mark Lee @Appeon 18 December, 2020
#16
Hi miky,
 
Unfortunately, I followed the case and operation steps you provided but didn't reproduce the issue on my computer.
 
I checked your screenshot and it definitely is an issue. However, I couldn't transfer it to our development team for further analysis since I didn't reproduce it.
 
May I ask if you can reproduce this issue on other computers? Or is there anything wrong with the operation steps or code?

Regards,
Mark Lee
Mikulas Klasovsky 15 December, 2020
#15
version2622.PNG (77KB)

hi,
yes i used 2622 you provided
attached is the about screen image

thanks

miky
Mark Lee @Appeon 15 December, 2020
#14
Hi miky,

Just to confirm this, did you tested with PowerBuilder 2019 R3 Beta2 (build 2622)?
I will reply to you about your test steps later.

Regards,
Mark Lee
Mikulas Klasovsky 15 December, 2020
#13
NativePDFIssue_margins.zip (493KB)

Hi Mark,
I know this was reported by Valdas, however I did some testing on your new update with the following findings:
It looks like you managed to correct the left margin, however it seems like right margin is still somehow not respected (i did not test top and bottom yet).
in attached small application you can try the following steps and compare your pdfs to my attached pdf outcomes.

steps:
1. select "Microsoft Print To PDF" printer in the top dropdown and hit "Print" button to print the PDF (my resulting pdf - 01_MSPrintToPDF.pdf)
2. hit "SaveAs" button to save using NativePDF Method (02_NativePDF_afterMSprintToPDF.pdf)
3. select "OneNote (Desktop)" printer and hit "Print" button (no need to actually save in one note)
4. hit "SaveAs" button to save using NativePDF Method (04_NativePDF_afterOneNoteDesktop.pdf)

in the attached pds and alse in image "NativePDF_margins.PNG", you can see the difference in those two files saved using NativePDF, where the one after OneNote used was "stretched" and thus has 2 pages.

Could you please have a look if this should be covered with the fix you provided?

thanks

miky
Mark Lee @Appeon 11 December, 2020
#12
Hi Valdas,

Good news that PowerBuilder 2019 R3 Beta2 (build 2622) is available for your evaluation. The issue you reported has been fixed in this release. Please download and install it to verify the issue you reported and let us know if any problems. Here is the link for this PowerBuilder 2019 R3 Beta2:
https://file.appeon.com/download/Installer/PowerBuilder/Beta/PowerBuilderInstaller_bootstrapper.exe

We welcome all feedback from you!
 
Regards,
Mark Lee
Mark Lee @Appeon 01 July, 2020
#11
Hi Valdas,

3. What virtual printer is NativePDF using?
Answer: NativePDF doesn't use any virtual printer, but as for some special data, that will relate to the default printers settings of the client machine.
And this is also what we need to improve in a future version.

4. As I mentioned earlier, option "Let Windows manage my default printer" does
not seem to affect NativePDF margins. Last used printer or last print job
somehow affect NativePDF margins.
Answer:  The difference is that after setting the "OneNote (Desktop)" printer to the default printer, if you use the NativePDF to export the PDF file, the page margin will be lost. If you change the default printer to another printer (virtual printer or physical printer), then if you use the NativePDF to export the PDF file again, you will find that it works this time.

Regards,
Mark Lee
Valdas Vaitiekaitis 30 June, 2020
#10
Thank you for your answer, hope your fix will not take too long.

3. What virtual printer is NativePDF using?

4. As I mentioned earlier, option "Let Windows manage my default printer" does not seem to affect NativePDF margins. Last used printer or last print job somehow affect NativePDF margins.
Mark Lee @Appeon 30 June, 2020
#9
Hi Valdas,

Thanks for your quick feedback.
1. Sorry that I didn’t notice the "OneNote (Desktop)" printer settings issue before.

2. We can reproduce it on our side and will do further research to figure it out. And we will keep you updated.

3. As for why it is related to the printer the user is using, this is one of the limitations of technology implementation. 
Even if you use GhostScript or Amyuni to export the PDF file, it will also require a virtual printer installed first.
Currently we haven’t found out a good way to work it around but we will analyze this issue in the future.

4. For your issue, we suggest you temporary work it around via disabling this option. Thanks for your understanding.

Regards,
Mark Lee
Valdas Vaitiekaitis 29 June, 2020
#8
It is not resolved, why does NativePDF care what printer user is using? I can not force every user disable this option, and removing this option does not solve anything, margins are still being lost.
Mark Lee @Appeon 29 June, 2020
#7
Hi Valdas,

Thanks for providing the test case and let us know that this issue has been resolved.
I think the disabled option "Let Windows manage my default printer" is the key.
Since this issue is solved, may I now close this ticket?

Regards,
Mark Lee
Valdas Vaitiekaitis 29 June, 2020
#6
Did some more testing, default printer is not the issue here, failed print is what causes this misbehaving.

I've disabled option "Let Windows manage my default printer" and set a specific printer as default. If I try to export after successful print, I get correct margins, if I try to export after unsuccessful print, margins are lost. If I restart the app after unsuccessful print and then export, margins are OK...

However our production app fails to export margins without failing a print. It does not have the print option altogether, and it is restart every time. I just tried exporting same DataWindow I exported a week ago and now I have two PDF files of same DataWindow with different margins, so I am completely lost here...
Valdas Vaitiekaitis 29 June, 2020
#5
NativePDFTest2.zip (74KB)

I did some more testing, looks like issue is not the PB version, but something with Windows default printer.

I attached a new test case with a Print button, and these are the steps I took:

1. First I printed to pdf using "Microsoft Print to PDF" printer, resulting pdf file 1_print_to_pdf.pdf is included in the attachment. Margins are as expected.
2. Then I tried to export to PDF, included file 2_export_after_successful_print.pdf, again margins are as expected.
3. Then I tried to print using some random "OneNote (Desktop)" printer, but as I never ran OneNote I got an error and print failed. However now "OneNote (Desktop)" printer is marked as default in Print dialog
4. Now with wrong printer when I try to export to pdf I lose margins, see included file 4_export_after_failed_print.pdf.

In theory I could change settings so that default printer is fixed and does not change every print, however I can not force all our clients to do so, nor can I force them to use appropriate default printers, because "OneDrive (Desktop)" printer was not the only one causing margins to be lost.
Mark Lee @Appeon 27 June, 2020
#4
Hi Valdas,
 
1. Just to let you know, since NativePDF has been supported starting from PB 2017 GA, it has never supported setting the margins method.
 
2. I also used the test case you provided in both PB 2019 build 2151 and build 2170, and I got the same PDF file result.
 
BTW, in your test case, we didn't find any code that specifies margins settings and the Datawindow margin property is also using the default value.

Regards,
Mark Lee
Mark Lee @Appeon 26 June, 2020
#3
Hi Valdas,

Thanks for report the problem. We'll work on it and get back to you soon.
Thanks for your patience and understanding.

Regards,
Mark Lee
Valdas Vaitiekaitis 26 June, 2020
#2
This issue was not present in PB 2019 build 2151, it does reproduce in PB 2019 build 2170.
Valdas Vaitiekaitis 26 June, 2020
#1
NativePDFTest.zip (12KB)

*Phenomenon:
After exporting DataWindow using NativePDF resulting PDF has reduced margins.

*Reproduce Steps:
See attached sample.

Remarks:
This issue was not present in PB 2019.
OS:
Windows 10
Platform:
32-bit
Database Type:
Database Version: