1. Tracy Lamb
  2. PowerBuilder
  3. Sunday, 1 July 2018 17:02 PM UTC

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 @Appeon Accepted Answer Pending Moderation
  1. Sunday, 1 July 2018 19:57 PM UTC
  2. PowerBuilder
  3. # Permalink

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.


Regards ... Chris

  1. Tracy Lamb
  2. Friday, 13 July 2018 16:17 PM UTC
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)


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

  1. Helpful
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 13 July 2018 16:40 PM UTC
  2. PowerBuilder
  3. # 1

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.


There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Sunday, 1 July 2018 18:18 PM UTC
  2. PowerBuilder
  3. # 2


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.


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.