Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Creating a link to a particular page of a pdf

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,692
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default Creating a link to a particular page of a pdf

    Is there a way to create a hyperlink to a pdf that opens the online pdf to a particular page? Some pdfs can be rather long and if I am referencing a particular page it would be a little more convenient to let the page open to a particular location in the pdf.
    Last edited by james438; 01-10-2014 at 05:35 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,191 Times in 3,155 Posts
    Blog Entries
    12

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    This won't work for many users-- Acrobat is widespread for Windows (but not ubiquitous) and rare elsewhere. Mac users for example have a special plugin for Safari (the default browser) and many, like me, use a different browser and prefer to automatically download and open the documents in Preview (a viewer of various document types-- mostly images, pdfs). I'm not sure about Linux.

    As a helpful hint, sure, there's no problem with this, but don't rely on it.

    The required solution here is to simply list the page number for the user's information-- the great thing about PDFs is that they're a print format and consistent across computers, so you can easily refer to a page number, not something that works at all with normal hyperlinks to webpages.


    Additionally, if you're creating the document itself, you can do one of two things:
    1. Add a table of contexts that will direct them to the right section. Not all users are aware of this, but it can help for those who are. This works as bookmarks within the document itself; I don't think there's any (consistent) way to link to them from outside though.
    2. Save the document so that a certain page is open when the document loads. I *think* this works for most viewers, but you'd have to test it to be sure.
    Actually implementing either (depending on how you are generating the PDF) could be challenging, but it should be possible.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,692
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Thank you for the answers. I do get somewhat different results depending on the browser I use (namely Opera), so I will continue to cite page numbers next to my reference links. Also setting the page with #page=3 when it does work will take the user to page 3 of the document as opposed to the third page of the document. The difference is that the table of contents would not be counted when using #page=3 if what I am really referencing is the preface located before the document, but after the table of contents of the pdf. I hope that makes sense.

    I hadn't done a google search for the answer earlier which was silly on my part. I'm not sure what I was thinking at the time. Ah, well.

    Looking at the different parameters for viewing a pdf via URL I found this document to be the most useful: parameters for opening a pdf file, but it still didn't answer how to open the third page as opposed to page 3. If I were the creator of the pdf I could solve this easily, but if I am not and the option is available it does not appear to be something I can easily look up.
    To choose the lesser of two evils is still to choose evil. My personal site

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,191 Times in 3,155 Posts
    Blog Entries
    12

    Default

    Are you saying that the first page in your document isn't page one? Like if you were to use #page=1 there would still be pages before that?

    If so, I think if you have a standard or pro version of Acrobat (as opposed to just the reader) you can mark named destinations (like a named anchor in HTML) in any part of a document and use them.

    One other thing you might try in a case like that would be using negative numbers, #page=-1 for the page 2 pages before page one if there are such pages.

    Then again, you might just be confused by Opera. I found that once the document was loaded it didn't work so well in Opera. But that for a fresh link it worked fine.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,692
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    I noticed that I had to open a fresh page as well. Some of the odd things I noticed when using Opera version 12 and the developer version was that page 3 would open paragraph 3 instead or it would open page 6. The results were not consistent either. I have since downloaded the latest version of acrobat reader and that appears to have cleaned up the errors I was seeing with Opera. I'm not sure how old my version of acrobat reader was.

    I thought that what acrobat reader considered page 3 when using #page=3 was the third page of the document, but I may have read that wrong as I had trouble repeating it. This would be a little confusing if it was that way because some of the pdfs I read are snippets of much longer documents. For example one document consisted of pages 1569 to 1674. It appears that #page=3 always refers to the third page rather than page 3 of a document, which happens to be the way I was hoping to get it to work.
    Last edited by james438; 01-09-2014 at 05:52 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Most often,* the identifying information for pages in a PDF is just numerical starting from 1 up to the end. It doesn't matter if there's any preface or table of contents or other material before page numbering would actually start (in a book, etc.). However, I think that technically each page is named (not in the text, but in the metadata, visible if you look at the thumbnails, I believe). So you should be able to figure out what page you want to go to (regardless of content, what metadata it has to identify it) and link to that. But again, it won't always be consistent by browser.

    (*I have seen some documents, such as old books from archive.org, where the page numbering is properly aligned to the actual pagination in the text with some other numbering system used for the first few document pages then the actual page numbers, starting with 1, used later in the document.)

    Note: I haven't really tested any of this, but I do use PDFs a lot. It'll take some trial and error to figure it out, and it'll probably work fine for some/most browsers.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,692
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    When adding pdf parameters to a hyperlink I will try to test it out in multiple browsers first. I usually just view pdf documents within the browser, but if you download the pdf and then view it with adobe reader there appear to be more options available.

    I will be sure to test the hyperlinks out with multiple browsers in the future when using pdf parameters. I was thinking that the unusual results were entirely on my end due to using an outdated reader, but that doesn't mean that the other parameters will create odd results including error messages with other browsers. I can play around with what you've told me about how the page numbering works as well as the metadata.

    Question resolved.
    To choose the lesser of two evils is still to choose evil. My personal site

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,191 Times in 3,155 Posts
    Blog Entries
    12

    Default

    I think what might be getting lost here is that most of the time this will work.

    The one thing I'm uncertain of is the case of a document that spans multiple PDF files. Sounds like the page numbers, if sequential, work. Like if the 5th page of the second file in the document in page #105 in the overall document that #page=105 is used to reach that, right?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,692
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    True, in the majority of cases it will work, but with the odd results I have recently had I will be sure to test this out in multiple browsers first in case it was not due to my using a version of adobe reader that was probably a year or more old.

    As far as the example you listed it sounds like using #page=105 would be correct, but I have not heard of a document that spans multiple pdfs before.
    To choose the lesser of two evils is still to choose evil. My personal site

Similar Threads

  1. Resolved Image Thumbnail Viewer II - creating an extra link
    By europe451 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 12-29-2010, 02:30 PM
  2. Creating different windows in a page
    By Sikky in forum CSS
    Replies: 2
    Last Post: 03-17-2008, 07:16 PM
  3. Help creating a current link
    By SayJumner in forum CSS
    Replies: 28
    Last Post: 12-08-2007, 01:10 PM
  4. Creating Dynamic PHP Link in.js file
    By eday_2010 in forum PHP
    Replies: 7
    Last Post: 02-23-2007, 05:01 PM
  5. Creating a login page
    By ColoradoEquestrian in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 11-07-2006, 01:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •