PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: guest188 on July 17, 2018, 03:44:05 PM

Title: Invoke PDF at Bookmark
Post by: guest188 on July 17, 2018, 03:44:05 PM
Is there a way to invoke a PDF file at a specific bookmark? Or, I guess opening it at a given page would be okay, but I'd prefer to use a bookmark.

Given a PDF called "test.pdf", which has multiple bookmarks, one of which is "Bookmark01".  I currently open the PDF as follows:

SYSTEM_HELP "test.pdf"

Could I maybe do something like...

SYSTEM_HELP "test.pdf;@Bookmark01"
Title: Re: Invoke PDF at Bookmark
Post by: Devon Austen on July 17, 2018, 04:17:47 PM
Here is some Adobe Acrobat Reader Documentation that may help.

https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf#page=5&zoom=auto,-169,394

I was able to accomplish what you were trying to do with the following

Code: [Select]
invoke """C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"" /A ""page=5"" ""test.pdf"""

If the PDF is on the web it can be done with a #page=5 at the end of the URL or a #nameddest=destination.
Title: Re: Invoke PDF at Bookmark
Post by: Mike King on July 17, 2018, 04:29:31 PM
Another option is to use *browser and pass it the page number or bookmark as in:

Code: [Select]
def object h,@(0,0,80,24)="*browser"
h'navigate2("file://c:/temp/111/test.pdf#page=5")

This works with Page numbers (#page=nnn) or Named destinations (#name).
Title: Re: Invoke PDF at Bookmark
Post by: guest188 on July 17, 2018, 05:24:24 PM
I am using SYSTEM_HELP so I would not have to specifically code for Adobe or a browser to display the file, I want Windows to use whatever is configured for rendering PDFs - that's what SYSTEM_HELP is doing just fine with SYSTEM_HELP "test.pdf"

So, none of the following work...

SYSTEM_HELP "test.pdf#Bookmark01"
SYSTEM_HELP "test.pdf#namedest=Bookmark01"
SYSTEM_HELP "test.pdf#page=3"

Oh, and my PxPlus 2017 does not have a *browser control.


Title: Re: Invoke PDF at Bookmark
Post by: Mike King on July 17, 2018, 05:37:55 PM
The OS interface provided by Windows does not allow the passing of a page or bookmark as the interface within Windows looks at the prefix (i.e. http://) or the suffix (last dot onwards such as .exe, .pdf, ...).  You have neither a recognizable prefix nor suffix thus the OS has no idea how to help open the file.

And trying "file://c:/name/of/directory/test.pdf#page=3" doesn't work -- it might if you had Chrome installed and set to respond the the file:// prefix but generally this is IE or EDGE.
Title: Re: Invoke PDF at Bookmark
Post by: Mike King on July 17, 2018, 06:03:49 PM
Additional note -- your PxPlus 2017 should have a *browser control -- it came standard with PxPlus and should have been installed automatically.

Make sure your license is for PxPlus 2017 (V14).