1. Tracy Lamb
  2. PowerBuilder
  3. Sunday, 01 July 2018

How can I open a PDF file for viewing?  My db has a list of PDF files that are stored on the file system.  I'd like to provide the option for my users to open/view the file from my application instead of through the file system.

Accepted Answer
Chris Pollach Accepted Answer Pending Moderation
1
Votes
Undo

Hi Tracy;

  In addition to Andreas excellent answer .. another alternative is to host your PDF file(s) on a web server and then use PB's iNET object's HyperlinkToURL ( ) method to deliver the PDF to the user machine's web browser where your PB App is executing.

HTH

Regards ... Chris

Comment
Thank you... I chose this way as it seems to be the easiest and most "fool proof". Here's what I did (straight from the manual):

GetContextService("Internet", iinet_base)

iinet_base.HyperlinkToURL(sle_url.text)



It doesn't open the PDF in Adobe Acrobat Reader, but I think this solution will be fine. Thanks again.

~~~Tracy
  1. Tracy Lamb
  2. Friday, 13 July 2018
There are no comments made yet.
  1. Sunday, 1 July 2018
  2. PowerBuilder
  3. # Permalink
Tracy Lamb Accepted Answer Pending Moderation
0
Votes
Undo

Thank you for answering!  I tried the shellexecute(…) and it works great!  My only issue is that I don't know how to disable editing of any kind.  The documents my users will be viewing will all be "read only".  I'm guessing that if you have a version of Adobe Acrobat that allows editing, then the user would be able to make changes and save the document back to the same location.  That doesn't seem possible with the HyperlinkToURL() solution.

Again, thank you most kindly for taking the time to respond! Much appreciated.

~~~Tracy

Comment
There are no comments made yet.
  1. Friday, 13 July 2018
  2. PowerBuilder
  3. # 1
Andreas Mykonios Accepted Answer Pending Moderation
0
Votes
Undo

Hi.

You can use the shellexecute win32 function. Here is the way to declare it:

FUNCTION long ShellExecute (uint ihwnd, string lpszOp, string lpszFile, string lpszParams, string lpszDir, int wShowCmd ) LIBRARY "Shell32.dll" ALIAS FOR "ShellExecuteW"

This is an example of using that function:

shellexecute(handle(this), "open", "c:\1.pdf", ls_null, ls_null, 0)

Of course before using it, you will have to save your pdf from db to some place in your hdd.

An alternative is to use Adobe Acrobat Browser ActiveX Control.

Andreas.

Comment
There are no comments made yet.
  1. Sunday, 1 July 2018
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.