1. P Laceholder
  2. PowerBuilder
  3. Friday, 28 January 2022 10:01 AM UTC

Good morning Appeon community,

I am wondering, is there a native tool to visualize (end perhaps interact) with PDF files? In our current PB applications we are using a third party activeX but we would gladly move away from it.

I tried also the axAcroPDF (Acrobat Reader DC ActiveX) but it was missing some features that are of our interest.

The features that we are interested on are the following:

  • Printing (externally) through a cb_clicked button
  • Searching text (externally) through code
  • Skip to page N (through code)
  • Page forward / backward (through code)
  • Zooming (+ and -) still through code

So the users interact with our powerbuilder buttons and not something integrated in the reader.

(example in the uploaded picture file)

Best Regards.

Attachments (1)
Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 30 January 2022 18:18 PM UTC
  2. PowerBuilder
  3. # Permalink

URL examples from https://pdfobject.com/pdf/pdf_open_parameters_acro8.pdf:

http://example.org/doc.pdf#Chapter6
http://example.org/doc.pdf#page=3
http://example.org/doc.pdf#page=3&zoom=200,250,100
http://example.org/doc.pdf#zoom=50
http://example.org/doc.pdf#page=72&view=fitH,100
http://example.org/doc.pdf#pagemode=none
http://example.org/doc.pdf#pagemode=bookmarks&page=2
http://example.org/doc.pdf#page=3&pagemode=thumbs
http://example.org/doc.pdf#collab=DAVFDF@http://review_server/Collab/user1
http://example.org/doc.pdf#page=1&comment=452fde0e-fd22-457c-84aa-2cf5bed5a349
http://example.org/doc.pdf#fdf=http://example.org/doc.fdf
URL limitations
● Only one digit following a decimal point is retained for float values.
● Individual parameters, together with their values (separated by & or #), can be no greater then 32
characters in length.
● You cannot use the reserved characters =, #, and &. There is no way to escape these special characters.
● If you turn bookmarks off using a URL parameter when a document had previously been saved with
bookmarks on, the bookmark scrollbars are displayed at first, and only disappear once Acrobat obtains
enough streamed information to render the full page. 

What I cannot find is how to do a "search".

Comment
  1. P Laceholder
  2. Monday, 31 January 2022 07:39 AM UTC
Thank you very much for the detailed answer! I will discuss with my colleagues about this option and see if it works out for them.
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 31 January 2022 07:55 AM UTC
Yw, one thing though, test very well before you decide to use the webbrowser control. There's like 40 or 50 tickets on the support site, some of them complaining it stops working after some time. Maybe for your purpose, these bugs won't be a problem.

regards.
  1. Helpful 2
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 30 January 2022 18:49 PM UTC
  2. PowerBuilder
  3. # 1

To be honest, I don't really understand why the user has to use "powerbuilder buttons" for the navigation, but I guess that's because I don't know anything.

What I can't find is how to do a "search". Maybe it can be done using JS and a free library like "jsPDF". https://jspdf.readthedocs.io/en/latest/ but I'm an absolute noob in JS and I'm not sure if JS is the best solution due to vulnerabilities etc.

good luck!

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 30 January 2022 18:06 PM UTC
  2. PowerBuilder
  3. # 2

If you want to navigate to a certain page using the webbrowser you can do something like this (to go to page 4 of the pdf):

// make sure you first go to a different page (caching is involved!) like for example:
about:blank

// introduce a small delay to make sure the previous page has loaded:
sleep(1)

// navigate ot page 4:
file:///xxxxxxxx.pdf#page=4

From: https://stackoverflow.com/questions/39756834/c-sharp-webbrowser-navigate-to-another-page-in-pdf 

I don't know about the rest of the other commands you might need.

Comment
  1. Miguel Leeuwe
  2. Sunday, 30 January 2022 18:16 PM UTC
This is how you can zoom:

file:///xxxxxxxx.pdf#zoom=200

see my next answer for more info
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 28 January 2022 10:35 AM UTC
  2. PowerBuilder
  3. # 3

What about loading it in the WebBrowser control of PB 2019 R3 or newer?  

Comment
  1. P Laceholder
  2. Friday, 28 January 2022 10:37 AM UTC
I took it as a possiblitiy, can I do all the things listed above through code tho?

Regards, A.
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Friday, 28 January 2022 11:15 AM UTC
Probably not through code. But user should be able to navigate the PDF. To programmatically manipulate, most likely you are going to need a third-party PDF viewer.
  1. Helpful 1
  1. P Laceholder
  2. Friday, 28 January 2022 11:31 AM UTC
Sadly one of our requirements is also being able to find data within the pdf files through code, because of also some automated tests that are integrated.
  1. Helpful
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.