1. Larry Peters
  2. PowerBuilder
  3. Wednesday, 7 December 2022 22:12 PM UTC

I'm using PB2021 Build 1509.

I wish to view PDF files in a window (does not necessarily need to be a datawindow).

Can anyone provide me sample code for me to look at?

I have had limited success using an ole object inserting "Adobe Acrobat Browser Control" and also "Adobe Acrobat Reader". Either works using the ole_1.loadfile() method. Can someone explain the difference between these two? Is there another 3rd-party control recommended?

However, I always get a banner "This file claims compliance with the PDF/A standard and has been opened read-only to prevent modification". I cannot find any way to suppress this banner. Googling it says: Under Edit - Preferences - Documents, change the "View documents in PDF/A mode" to "Never". How do I implement this suggestion?

TIA

Larry Peters Accepted Answer Pending Moderation
  1. Saturday, 10 December 2022 18:49 PM UTC
  2. PowerBuilder
  3. # 1

Thanks Andreas, I will look at this.

Comment
There are no comments made yet.
Larry Peters Accepted Answer Pending Moderation
  1. Saturday, 10 December 2022 18:48 PM UTC
  2. PowerBuilder
  3. # 2

Thanks Armeen.

That is what I am currently doing. However, the usual programs in use (Acrobat or Web Browser) take over the whole screen. The point of my question is to control the reader within my own window.

Comment
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Thursday, 8 December 2022 16:08 PM UTC
  2. PowerBuilder
  3. # 3

Hi Larry,

Sorry, thought you were wondering where to change this in the GUI. Notwithstanding Miguel's reply for the moment (and he does have a valid point to take into consideration), yes, you can change this setting in the Registry. The key is HKEY_CURRENT_USER\SOFTWARE\Adobe\Adobe Acrobat\DC\AVDisplay and the value name is iPDFAPolicy (your exact key may differ depending on version etc.). Currently it's likely set to 2 but if you change it to 0 that would have the same effect as doing so through the GUI.

However, there are some things to consider here in using this approach: 1) when you make this change, if you have Adobe Reader open at the time, my understanding is that this will not take effect until Adobe is closed and then re-opened but you should test this to know for sure 2) there may be other unintended consequences by changing this value (beyond just preventing the banner from being shown) and so you may wish to find more info on that first and, of course, 3) Miguel's point which, as mentioned, is an important one. As well, there may be Group Policy issues that prevent your PB application from changing these values anyway.  The application may need escalated permissions, run in admin mode etc.

Again, HTH...regards,

Mark

 

Comment
  1. Andreas Mykonios
  2. Friday, 9 December 2022 11:36 AM UTC
As this setting is in HKEY_CURRENT_USER it's probable he will be able to change it. To take Miguel's point in account, I would reset this setting to it's original value right after opening the pdf. Not to value 2 but to whatever it's before changing it.

Andreas.
  1. Helpful 1
  1. Mark Goldsmith
  2. Friday, 9 December 2022 14:08 PM UTC
Great suggestion Andreas!
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 10 December 2022 09:06 AM UTC
We are assuming that all users have Adobe Acrobat installed. In the past I've also seen that for different versions (Adobe pro) there are different paths in the registry).

I'd still prefer to use ShellExecute, as explained here by Andreas: https://community.appeon.com/index.php/qna/q-a/open-file-to-view?limitstart=0#reply-8250

regards
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 8 December 2022 07:48 AM UTC
  2. PowerBuilder
  3. # 4

Hi.

I attach a simple application that I wrote some time ago for testing purposes. Feel free to test it and see if it can help you.

There are two windows: a) one working Adobe Acrobat Browser Control, b) second using webbrowser control.

For webbrowser control I have some additional controls that normally should affect how your document will be displayed. I don't remember if all those settings worked in PB 2021, but I remember that many of them did worked in PB 2022 (webbrowser control is updated in that release).

Andreas.

Attachments (1)
Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 8 December 2022 05:56 AM UTC
  2. PowerBuilder
  3. # 5
Comment
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Thursday, 8 December 2022 00:54 AM UTC
  2. PowerBuilder
  3. # 6

Hi Larry,

This setting is in Acrobat itself and so when viewing the document via Acrobat Reader it will or will not display the banner depending upon the setting.  You need to open Adobe Reader and click on Edit, then Preferences and then highlight the Documents category. Where you change this setting can be seen in the picture below:

HTH...regards,

Mark

 

 

Comment
  1. Larry Peters
  2. Thursday, 8 December 2022 02:47 AM UTC
Hi Mark,

Thanks. I did know that but I was hoping to programmatically override that setting without involving the user or having him change his preferred settings.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 8 December 2022 05:51 AM UTC
Hi Larry,

You should never ever change any settings of any user in any third party application. The security might be imposed by their company, or it's just because the user wants to have those settings. Anything you change will probably also affect other applications.

regards.
  1. Helpful 1
There are no comments made yet.
Larry Peters Accepted Answer Pending Moderation
  1. Wednesday, 7 December 2022 23:18 PM UTC
  2. PowerBuilder
  3. # 7

Thanks Armeen,

I have tried the WebBrowser control and it works in that I can view the PDF file. However, the document size is unexpected. Furthermore there are buttons on-screen which control zoom and resize. I'll need to research to control all that. Seems like a good alternative if I cannot find an Acrobat solution.

 

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 7 December 2022 22:36 PM UTC
  2. PowerBuilder
  3. # 8

How about skip OLE and directly load the PDF in the WebBrowser control:  https://docs.appeon.com/pb2022/objects_and_controls/WebBrowser_control.html

 

Comment
  1. Miguel Leeuwe
  2. Thursday, 8 December 2022 05:52 AM UTC
Or use the ShellExecute windows API to have the pdf being opened by whichever default windows application has been set for PDF files.

If you do a search on this Q&A on "ShellExecute", I'm pretty sure you can find examples.
  1. Helpful
  1. Roland Smith
  2. Sunday, 11 December 2022 01:13 AM UTC
  1. Helpful 1
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.