hyperlinking to a specific page in pdf from Excel

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
chrisgj
User
Posts: 7
Joined: Tue Jun 30, 2009 9:19 am

hyperlinking to a specific page in pdf from Excel

Post by chrisgj »

I have tired to create a hyperlink from excel to a specific page using the extension ".pdf#page=" or to a bookmark ".pdf#bookmark". However the document simply opens without going to the relevant page or bookmark. Is it possible to jump to a particular page in a pdf in Exchange-Viewer Pro? If so what is the format? What am I doing wrong?

Thanks in advance for any input.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinking to a specific page in pdf from Excel

Post by Tracker Supp-Stefan »

Hello chrisgj,

Are you trying to use those links from inside the spreadsheet directly or are you converting it to PDF as well?
Could you please provide us with a sample file?
(make sure to zip/rar/7z any samples first as the forums will only accept archives and pdf file attachments)

Links like
http://www.example.com/myfile.pdf#page=4
should work properly.

Best,
Stefan
chrisgj
User
Posts: 7
Joined: Tue Jun 30, 2009 9:19 am

Re: hyperlinking to a specific page in pdf from Excel

Post by chrisgj »

Thanks for the prompt reply. I am not looking to link to website but to documents held in a folder on my harddrive. Does that make a difference to the coding or approach?
chrisgj
User
Posts: 7
Joined: Tue Jun 30, 2009 9:19 am

Re: hyperlinking to a specific page in pdf from Excel

Post by chrisgj »

Sample attached
Attachments
test.zip
(20.36 KiB) Downloaded 164 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinking to a specific page in pdf from Excel

Post by Tracker Supp-Stefan »

Hi, chrisgj

For opening local files you need to use command line with syntax like this:

Code: Select all

PDFXCview.exe /A "page=10&zoom=200,250,100" mypdffile.pdf 
And not hyperlinks.

Best,
Stefan
User avatar
bawldiggle
User
Posts: 106
Joined: Mon Jul 01, 2013 6:22 am
Location: OZ by the sea

hyperlinking to a specific page in pdf from Excel ... ME TOO

Post by bawldiggle »

This info is invaluable for me too :)

What is the "/A" parameter for ?
... window state ?
I assume the mypdffile.pdf string would include the pdf-file path ?
--------------
EDIT:
Using "chrisgj" samples... I have tried (as cell hyperlinks) ...


G:\Excel to open PDF page\extracted\test.pdf#page=2
- opens PDF but not at page 2

PDFXCview.exe /A "page=2&zoom=200,250,100" G:\Excel to open PDF page\extracted\test\test.pdf
- alert, Cannot open file

PDFXCview.exe /A "page=2&zoom=200,250,100" "G:\Excel to open PDF page\extracted\test\test.pdf"
- alert, Cannot open file

Run:= PDFXCview.exe ... results in an error
Windows cannot find 'PDFXCview.exe'. Make sure you typed the name correctly, and then try again.
Path to exe is C:\Programs2\PDF-XChange\PDF Viewer\PDFXCview.exe
What am I doing wrong ? (Or should my question be to an Excel forum ?)

Thank you :?
Free PDF-XChange Editor since 12-Aug-2018
Free PDF-XChange Viewer for too long
... cautiously testing Editor
• Win-7 PRO 64bit | Win-7 Home 64-bit | Win-7 Home 32-bit ... fiddling with Linux Mint too
• ClassicShell GUI
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6897
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: hyperlinking to a specific page in pdf from Excel

Post by Paul - Tracker Supp »

Hi bawldiggle,

it looks like you are almost there. I used the following sucessfully:

Code: Select all

C:\Program Files\Tracker Software\PDF Viewer>PDFXCview.exe /A "page=2&zoom=200,250,100" "F:\Documents\vix160_vmrun_command.pdf"
Your line:
PDFXCview.exe /A "page=2&zoom=200,250,100" "G:\Excel to open PDF page\extracted\test\test.pdf"
- alert, Cannot open file
looks OK - are you sure the target file was there? It looks to me that the PDF was not at the path specified.
Run:= PDFXCview.exe ... results in an error
Windows cannot find 'PDFXCview.exe'. Make sure you typed the name correctly, and then try again.
Path to exe is C:\Programs2\PDF-XChange\PDF Viewer\PDFXCview.exe
What am I doing wrong ? (Or should my question be to an Excel forum ?)
Did you try using the full path to the Viewer? You have installed it in a nonstandard location - is it in your system $PATH?

hope that helps
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
User avatar
bawldiggle
User
Posts: 106
Joined: Mon Jul 01, 2013 6:22 am
Location: OZ by the sea

Re: hyperlinking to a specific page in pdf from Excel

Post by bawldiggle »

Paul wrote:Did you try using the full path to the Viewer? You have installed it in a nonstandard location - is it in your system $PATH?
Thanks Paul,
PDF-X is installed in a custom folder.
I didn't even think of a custom install might be the culprit.
Learning something new every day

Thanks
Free PDF-XChange Editor since 12-Aug-2018
Free PDF-XChange Viewer for too long
... cautiously testing Editor
• Win-7 PRO 64bit | Win-7 Home 64-bit | Win-7 Home 32-bit ... fiddling with Linux Mint too
• ClassicShell GUI
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6897
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: hyperlinking to a specific page in pdf from Excel

Post by Paul - Tracker Supp »

My pleasure :-)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
chrisgj
User
Posts: 7
Joined: Tue Jun 30, 2009 9:19 am

Re: hyperlinking to a specific page in pdf from Excel

Post by chrisgj »

I have been off the forum for a bit but am glad to see bawldiggle has resolved the hyperlinking issue for him. However it has not worked for me - I have uploaded where I have now got to with this and would be really grateful if you could explain where I am going wrong

Thanks in advance
chrisgj
Attachments
Copy of hyperlink to pdf test.zip
(7.31 KiB) Downloaded 157 times
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6897
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: hyperlinking to a specific page in pdf from Excel

Post by Paul - Tracker Supp »

Thanks Chris,

this has been reproduced here (again?) and a support request ticket raised: RT#2024: hyperlinking to a specific page in pdf from Excel The ticket is internal and includes this forum thread so anything added here will be seen in the ticket.

hth
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
User avatar
bawldiggle
User
Posts: 106
Joined: Mon Jul 01, 2013 6:22 am
Location: OZ by the sea

Re: hyperlinking to a specific page in pdf from Excel

Post by bawldiggle »

chrisgj wrote:I have been off the forum for a bit but am glad to see bawldiggle has resolved the hyperlinking issue for him. However it has not worked for me - I have uploaded where I have now got to with this and would be really grateful if you could explain where I am going wrong
Hi chrisgj :)

My glib response to "Paul Tracker" is rather thin
bawldiggle wrote:
Paul wrote: Did you try using the full path to the Viewer? You have installed it in a nonstandard location - is it in your system $PATH?
Thanks Paul,
PDF-X is installed in a custom folder.
I didn't even think of a custom install might be the culprit.
Learning something new every day
chrisjg I downloaded your ZIP file and extracted the Excel file. I could not understand your sample.
It is several months since I had this working, so if you can bare with me.

If you could post the full-string of one link in a reply post here, it might be obvious to me or others where the problem might be.

In the mean time ...
If PDFXCview.exe is installed in a custom location, not the default "C:\Program Files\" the link string MUST contain the full-name to PDFXCview.exe
  • On a new 32-bit PC "C:Program Files" folder, (by my standards), is already chock full of "stuff" I did not put there.
    I install all my 3rd party programs/apps/portables in a custom location "C:\Programs2"
So I must use "C:\Programs2\PDF-XChange\PDF Viewer\PDFXCview.exe" ... as the first part of the link-string.
"PDF-XChange" folder is my custom folder-name, because "Tracker Software" is meaningless to me at a glance.

The path to the PDF file MUST be the full path wrapped in quotes. (Paths with any spaces can be a problem if the path is not "wrapped")
eg,
G:\My path\myPDF.pdf ... will fail
"G:\My path\myPDF.pdf" ... is the correct way to structure the path-string.

Hope this is of some help -- to start -- if not...
What version of Excel are you running ?
Did you say the PDF file opens but not at the desired PDF page ?

Regards
Bawldiggle :)
Free PDF-XChange Editor since 12-Aug-2018
Free PDF-XChange Viewer for too long
... cautiously testing Editor
• Win-7 PRO 64bit | Win-7 Home 64-bit | Win-7 Home 32-bit ... fiddling with Linux Mint too
• ClassicShell GUI
Willy Van Nuffel
User
Posts: 2392
Joined: Wed Jan 18, 2006 12:10 pm

Re: hyperlinking to a specific page in pdf from Excel

Post by Willy Van Nuffel »

Interesting topic, but not immediatly PDF-Xchange related...

At my opinion the problem is in Excel (2010) itself.
Hyperlinks (to PDF's) are normally in the style of http://...
When PDF's are on a local disk, then the hyperlink is in the style of file:///...
In this case, it is not possible to add a bookmark to a page, in the style of #page=4. This will not work.

So, what you can do in Excel, to make that a PDF opens at the desired page is (at my knowledge) two possibilities:
1) create a hyperlink to a *.bat file, and in that bat-file, put the instruction to start wether
- Internet Explorer + reference to the PDF and its page
- PDF-Xchange viewer + reference to the PDF and its page
(both in the right syntax)

2) create a macro into the Excel file itself and use this macro via a 'button' on the sheet
- the macro will contain a 'Shell ( - program to start + file to open - )' instruction

Hope this ideas may help...
Willy Van Nuffel
User
Posts: 2392
Joined: Wed Jan 18, 2006 12:10 pm

Re: hyperlinking to a specific page in pdf from Excel

Post by Willy Van Nuffel »

Samples of syntax for an "Open_PDF.bat" file:

"C:\Program Files\Tracker software\pdf viewer\pdfxcview.exe" /a "page=4" "C:\path\PDF_filename.pdf"
"C:\Program Files\Internet Explorer\iexplore.exe" "C:\path\PDF_filename.pdf#page=4"


Sample of syntax for an Excel macro:

Shell ("C:\Program Files\Tracker software\pdf viewer\pdfxcview.exe /a page=4 C:\path\PDF_filename.pdf")
Shell ("C:\Program Files\Internet Explorer\iexplore.exe C:\path\PDF_filename.pdf#page=4")
chrisgj
User
Posts: 7
Joined: Tue Jun 30, 2009 9:19 am

Re: hyperlinking to a specific page in pdf from Excel

Post by chrisgj »

bawldiggle - thanks for your input.
I am using Excel 2010. I can get a "normal" hyperlink to a pdf to run using PDF viewer. My problem is trying to get it to open at the right page.

I have double-checked and the quotes are on the file name. The complete hyperlink I am using is "C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe /A "page=2&zoom=100,250,100" "c:\test\test.pdf" "

When I use my current approach the error when clicking in excel is "cannot open the specified file"
However when I lift the complete text and put it in Windows Run it works perfectly - going to the right page.

I am a bit flummoxed. I am not sure I know enough about programming macros to use the method of open.bat files suggested by Willy Van Nuffel.
However my impression was that you, bawldiggle, were able to get hyperlinks to open the pdf on the right page from excel without the need for macros or the use of open.bat files. Am I right?

Thanks both bawldiggle and Willy for your help to date.

chrisgj

'
Willy Van Nuffel
User
Posts: 2392
Joined: Wed Jan 18, 2006 12:10 pm

Re: hyperlinking to a specific page in pdf from Excel

Post by Willy Van Nuffel »

I think you must clearly see the difference between a hyperlink that uses "http" and a hyperlink that uses "file".
Simply put the mousepointer over the hyperlink in Excel and wait a few seconds untill the tooltip appears.

When http://... is shown, then the Internet browser of your computer will be used to open the indicated (PDF)-file.
If the pagenumber has been add to the hyperlink, then the PDF will be opened at the right page.

When file:///... is shown, the appropriate program will be used to open the file.
In case of PDF, your computer will normally start Adobe Reader or PDF-XChange Viewer (if installed).
REMARK: If the pagenumber has been add to the hyperlink, then the PDF will NOT be opened at the right page.

In normal conditions you can only make file:///.... hyperlinks to files on the local disk of your computer.
There are ways to start a local internet server but that is not something that is easily to explain.

That is why you will have to use an alternative solution, like one of thoose that I presented in my previous post.
Willy Van Nuffel
User
Posts: 2392
Joined: Wed Jan 18, 2006 12:10 pm

Re: hyperlinking to a specific page in pdf from Excel

Post by Willy Van Nuffel »

The solution via a BAT-file should not be too difficult.
Here is a step-by-step...

Make a text-file:
> via Windows Explorer :
> navigate to folder where you want to put this text-file
> right click in the right column of the window and click New > Text Document
> give a name to the new file (like Open_PDF) and change "txt" into "bat"
> press Enter to confirm.
Now right click on this new file and choose 'Edit' to open it.
Put the instruction into it that you want to execute.
You can choose between:
- an instruction to start Internet Explorer and open the PDF at the right page, or
- an instruction to start PDF-XChange Viewer and open the PDF at the right page.
See the correct syntax in my previous post (Sat Oct 05, 2013 10:48 am), here above.

Now in Excel, select the cell where you want to put the hyperlink.
Click Insert > Hyperlink, and navigate to the "bat" file that you just created.
Click once on the bat-file, and - before clicking "OK" - modify the "Text to display" if you wish to.
Finally click OK.

That must be it.
chrisgj
User
Posts: 7
Joined: Tue Jun 30, 2009 9:19 am

Re: hyperlinking to a specific page in pdf from Excel

Post by chrisgj »

Thanks so much for taking the time to set this out - however, I don't think it will address my particular problem - as I am trying to link to pdfs with different names and with different pages. - hence the solution I've tried. which pulls the names from a cell i.e. i think the open.bat solution you propose cannot pull differing parameters through - it would work if you simply wanted to open one particular pdf. Obviously I may be wrong as I am not a programmer - and I will have a play with your suggestion. (I may be wrong but I think bawldiggle had achieved the particular solution I need - albeit for some reason I am failing to replicate it!).

Thanks again
chrisgj
User avatar
bawldiggle
User
Posts: 106
Joined: Mon Jul 01, 2013 6:22 am
Location: OZ by the sea

Re: hyperlinking to a specific page in pdf from Excel

Post by bawldiggle »

Hi chrisgj :)

My experience ended at Excel 2003, although I have recently acquired Excel 2010.
And now I cannot find my working "link" sample. Hope I haven't led you astray.
My reason for trialing Excel to open PDF was an experiment, to view various file types from one Excel file.

Early in my career I tried BAT files, and I know they work, but I have managed to do everything I want (so far) with script files.

I have about 4,000 text files of code snippets that I now access with a file contents "finder" .. "FileSearchEX"
For almost 20 years I have managed everything I want using VBA and script files.
My needs were/are particularly narrow -- AutoCad + Excel and Word.
Excel addins and templates, Word templates all in VBA

Sorry to drag this out ...
What are you trying to achieve and why ?
Is it for personal use?
Are you locked into PDF (illustrations) ?

I am reasonably new to PDF -- so far I have overcome the "locked" PDF -- so that I can atleast "bookmark" certain sections.
  • Mostly user manuals that for some strange reasons device manufacturers must think there is gold bullion on their freely available PDF

As an afterthought, PDF paging does not always match the "publishers" page numbering.

At the moment I am trying to rescue a Dell laptop and run a business.
I am happy to stick with you but I am not always on tap.

I would like to have an over view of your project, so that (maybe) I can be of assistance.
Regards :)

PS: I have nominated you as a friend. I cannot find in this forum how to send you a PM.
Free PDF-XChange Editor since 12-Aug-2018
Free PDF-XChange Viewer for too long
... cautiously testing Editor
• Win-7 PRO 64bit | Win-7 Home 64-bit | Win-7 Home 32-bit ... fiddling with Linux Mint too
• ClassicShell GUI
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: hyperlinking to a specific page in pdf from Excel

Post by Will - Tracker Supp »

Hi Guys,

Thanks for all the input - much appreciated. The Devs. are looking into this and hope to include a fix soon, so the additional info. should prove help in ascertaining exactly where the issue lies :)

Cheers!
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: hyperlinking to a specific page in pdf from Excel

Post by Corwin - Tracker Sup »

Hi chrisgj,

You may try to do this with macros. Just create button and set this macros to it:

Code: Select all

Sub OpenPDF()
    programPath = Range("B8").Value
    fileToLaunch = Range("B7").Value
    Shell programPath + " " + fileToLaunch, vbNormalFocus
End Sub
HTH.
Attachments
Macros Sample.zip
(14.66 KiB) Downloaded 115 times
User avatar
bawldiggle
User
Posts: 106
Joined: Mon Jul 01, 2013 6:22 am
Location: OZ by the sea

Re: hyperlinking to a specific page in pdf from Excel

Post by bawldiggle »

Hi "Chrisgj" :)
I cannot find how to send you a personal message on this forum.
Maybe "Tracker" don't allow personal messages! ?

Code: Select all

Sub OpenPDF()
    programPath = Range("B8").Value
    fileToLaunch = Range("B7").Value
    Shell programPath + " " + fileToLaunch, vbNormalFocus
End Sub
If I remember rightly -- you have little experience with code.
If so, I am willing to help you, I have been writing VBA for 15 years.
Regards :)
Free PDF-XChange Editor since 12-Aug-2018
Free PDF-XChange Viewer for too long
... cautiously testing Editor
• Win-7 PRO 64bit | Win-7 Home 64-bit | Win-7 Home 32-bit ... fiddling with Linux Mint too
• ClassicShell GUI
chrisgj
User
Posts: 7
Joined: Tue Jun 30, 2009 9:19 am

Re: hyperlinking to a specific page in pdf from Excel

Post by chrisgj »

Thanks yet again bawldiggle - off for a week but I will try on my return!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: hyperlinking to a specific page in pdf from Excel

Post by Tracker Supp-Stefan »

Hello all,

Thanks for the help bawldiggle! Yes personal messages are disabled because they were used by spam bots in the past to flood the forum's genuine users.

Posting in this (or starting a separate topic) is perfectly fine for a discussion, and it would be public for others to benefit from it in the future if they experience the same problem.

Regards,
Stefan
Post Reply