1. Raquel Rodriguez
  2. PowerBuilder
  3. Wednesday, 17 August 2022 09:01 AM UTC

Hello,

 

How I can use a web browser control to open a PDF File?

 

And how I can know where de PDF file is open.

 

thank you so much in advanced.

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 17 August 2022 10:45 AM UTC
  2. PowerBuilder
  3. # 1

Hi,

Didn't you ask the same question some days ago?

https://community.appeon.com/index.php/qna/q-a/open-pdf-with-web-browser

regards.

Comment
  1. Raquel Rodriguez
  2. Thursday, 18 August 2022 06:08 AM UTC
Hello Miguel,



That's correct, but i cant understand so well, how to use the information, however was usefull, to know the options that i have to search.



Kind Regards
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 17 August 2022 11:23 AM UTC
  2. PowerBuilder
  3. # 2

Hi.

There are many ways to display pdf's files. Most of them will rely on 3rd party compenents. The most common way in latest versions of pb 2019 is using webcontrol.

You have to place a webcontrol on a window. Let say that your pdf to display is: "c:\MyPDFs\abcd.pdf". Also let say that your web control is called wb_1.

To load it to the webcontrol you need to give the following command:

wb_1.navigate("file:///c:/MyPDFs/abcd.pdf")

Pay attention to the change on fullpathname!

That way the file will be loaded to the web control. Unfortunately You cannot know when load is complete.

Another way is to use Adobe Acrobat Reader OLE - active-x control.

In your window you can add it as a control by creating an OLE Control. 

A window will show where you will select (acrobat reader must pre-exist on the computer):

With the selected control click on your window at the point you want to place the control.

To load the pdf you call the following command:

ole_1.object.loadfile("c:\MyPDFs\abcd.pdf")

I attach a simple pb project that demonstrates both solutions (PB 2019 R3 2779).

Andreas.

Attachments (1)
Comment
  1. Raquel Rodriguez
  2. Thursday, 18 August 2022 06:06 AM UTC
Thank you so much!! this is just i need, to understand how to open a pdf file.
  1. Helpful
  1. Tracy Lamb
  2. Friday, 19 August 2022 15:27 PM UTC
Thank you Andreas for the ViewPDF.zip example!
  1. Helpful
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Thursday, 18 August 2022 17:01 PM UTC
  2. PowerBuilder
  3. # 3

Here's what I do:

inet linet_base

GetContextService("Internet", linet_base)
linet_base.HyperlinkToURL(ls_filename)

Comment
  1. Tracy Lamb
  2. Friday, 19 August 2022 14:40 PM UTC
It's not clear to me from the PB Documentation how to open a pdf file in a web browser using HttpClient object?
  1. Helpful
  1. John Fauss
  2. Friday, 19 August 2022 15:54 PM UTC
Since the Inet object can be used for several different purposes, it is possible that the HTTPClient object is the suggested replacement only for some of the Inet object's functionality, not all. I wish the documentation was a little more helpful in this regard. I've seen your follow-up question, so we'll see what others say in response to that.
  1. Helpful
  1. Tracy Lamb
  2. Friday, 19 August 2022 16:08 PM UTC
I agree with John, "obsoleted" features aren't removed, they just aren't supported. My code is 26+ years old, and whenever I upgrade PB, I do get Warnings that a certain function/object/etc. is obsolete, but it still works. I've recently cleaned up all of those, except maybe now the iNet object! Sometimes, "if it ain't broke, don't fix it!"

  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.