Highlighted

Linking to a PDF file from a webpage

Contributor ,
Mar 25, 2019

Copy link to clipboard

Copied

How do you superheroes link to your .PDF files on your websites?

Do you just straight-up vanilla-link to them directly, or can that link be somehow refined in ways I'm unaware of?

(Does everyone just more or less do it the same way?)

Adobe Community Professional
Correct answer by Jon Fritz II | Adobe Community Professional

https://forums.adobe.com/people/Nancy+OShea  wrote

https://forums.adobe.com/people/Jon+Fritz+II   wrote

That is correct.

Here are some other things you can do with PDF links (if you're using the browser's plug-in)...

Link to PDFs from HTML -- The PowerPoint FAQ

Just to clarify, PDF parameters don't work with the built-in (browser API) readers in Chrome, Edge, Internet Explorer and Safari.   Unless you're using a really old browser,  plug-in support is gone.

.


When native PDF handling came out, absolutely nothing worked right, but there have been some updates to those native PDF handlers since their introduction.

I'm not sure about Safari (no Mac) but setting the page a PDF opens to works perfectly fine in Chrome, Edge, Vivaldi and Firefox with the built in readers under Windows 10. I haven't tested the other parameters, but it looks like zoom works in the majority of those browsers as well (Edge being the only one where it fails).

I imagine, as time passes, more support will be added and eventually, we'll have something fairly similar to the old Acrobat plug-in as far as feature sets are concerned.

Views

452

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Linking to a PDF file from a webpage

Contributor ,
Mar 25, 2019

Copy link to clipboard

Copied

How do you superheroes link to your .PDF files on your websites?

Do you just straight-up vanilla-link to them directly, or can that link be somehow refined in ways I'm unaware of?

(Does everyone just more or less do it the same way?)

Adobe Community Professional
Correct answer by Jon Fritz II | Adobe Community Professional

https://forums.adobe.com/people/Nancy+OShea  wrote

https://forums.adobe.com/people/Jon+Fritz+II   wrote

That is correct.

Here are some other things you can do with PDF links (if you're using the browser's plug-in)...

Link to PDFs from HTML -- The PowerPoint FAQ

Just to clarify, PDF parameters don't work with the built-in (browser API) readers in Chrome, Edge, Internet Explorer and Safari.   Unless you're using a really old browser,  plug-in support is gone.

.


When native PDF handling came out, absolutely nothing worked right, but there have been some updates to those native PDF handlers since their introduction.

I'm not sure about Safari (no Mac) but setting the page a PDF opens to works perfectly fine in Chrome, Edge, Vivaldi and Firefox with the built in readers under Windows 10. I haven't tested the other parameters, but it looks like zoom works in the majority of those browsers as well (Edge being the only one where it fails).

I imagine, as time passes, more support will be added and eventually, we'll have something fairly similar to the old Acrobat plug-in as far as feature sets are concerned.

Views

453

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 25, 2019 0
Adobe Community Professional ,
Mar 25, 2019

Copy link to clipboard

Copied

PDF is a media file.  Browser support for this media type is dicey since all major browsers quit supporting the Acrobat plugin and went to a native PDF API.  The API is OK for looking at images but  lacks support for  interactive PDFs  like forms.   I speak only for myself when I say I want to save PDF and open it in full scale Acrobat DC.  I do not want to view PDF in my browser.

Give me a straight link to the PDF file with some indication of it's file size in KB.   I can right click and take care of the rest myself.

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 25, 2019 1
Contributor ,
Mar 25, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Nancy+OShea  wrote

PDF is a media file.  Browser support for this media type is dicey since all major browsers quit supporting the Acrobat plugin and went to a native PDF API.  The API is OK for looking at images but  lacks support for  interactive PDFs  like forms.   I speak only for myself when I say I want to save PDF and open it in full scale Acrobat DC.  I do not want to view PDF in my browser.

Give me a straight link to the PDF file with some indication of it's file size in KB.   I can right click and take care of the rest myself.

How about offering "open in browser" and "save to file" options... is that a thing?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 25, 2019 0
Adobe Community Professional ,
Mar 25, 2019

Copy link to clipboard

Copied

It's nothing I need or care about.

Most people already know how to handle PDF files.

If you have a lot of PDF files or a very large one such as a book, then you can ZIP it which will force a download in most browsers.

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 25, 2019 1
Adobe Community Professional ,
Mar 26, 2019

Copy link to clipboard

Copied

For modern browsers, you can add the download attribute to the pdf link, which will download the file rather than opening it in the browser window...

<a href="yourpdf.pdf" download>Download the PDF</a>

... but Nancy's suggestion works in all browsers.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 26, 2019 1
Contributor ,
Mar 26, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Jon+Fritz+II  wrote

For modern browsers, you can add the download attribute to the pdf link, which will download the file rather than opening it in the browser window...

<a href="yourpdf.pdf" download>Download the PDF</a>

See, this is why I come here to ask dumb questions. Every once in a while, I'll learn something new I feel I should have known all along. Like this 'download' attribute. This is literally the first time I've ever seen that syntax.

Are there OTHER such attributes one can feed the <a> tag that will refine the experience, alongside 'download'? For instance, can I tell the PDF file to open full-screen via a similar attribute in the <a> tag?

IF not (if 'download' is the only one recognized by enough browsers to matter) then wouldn't the following code offer the user both options? Like :

<a href="yourpdf.pdf">Open the PDF</a>

<a href="yourpdf.pdf" download>Download the PDF</a>

Is there an 'open' attribute as an alternative to 'download', or does simply not putting 'download' presume 'open' with nothing added? I believe PDF files open in-browser by default on all 3 major modern browsers, right?

And finally, are there other commands I can pass to the PDF file through the <a> tag?

Thanks!

PS: Older browsers represent a negligible proportion of the target audience. This is for desktop + mobile, but more on the updated side than the obsolete one (younger people, more tech-oriented).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 26, 2019 0
LEGEND ,
Mar 26, 2019

Copy link to clipboard

Copied

Mozilla Developer Network has the answers. 

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 26, 2019 1
Adobe Community Professional ,
Mar 26, 2019

Copy link to clipboard

Copied

Yes, there are other "boolean attributes" under html5. For example: autoplay. We don't need to say autoplay="true" anymore, the presence of autoplay in a video tag is enough for the browser to assume "true" while its absence is assumed as "false". If you do a search for "Boolean HTML attributes" you should get a few sites that list what's available.

For browsers that don't recognize "download" it's simply ignored. In your example, under IE9, both links would do whatever the default action on PDFs is for the browser. In Chrome, the top would follow your default PDF handling settings and the bottom would download.

Are there other commands you can pass to a PDF through the <a> tag?

Yep...

<a href="myfile.pdf#page=4">

...will open a PDF to page 4 when clicked. I'm not sure if the latest native PDF viewers pay attention to it though. Worst case, it just opens the PDF on page 1.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 26, 2019 1
Contributor ,
Mar 26, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Jon+Fritz+II  wrote

<a href="myfile.pdf#page=4">

...will open a PDF to page 4 when clicked. I'm not sure if the latest native PDF viewers pay attention to it though. Worst case, it just opens the PDF on page 1.

Amazing. I'm assuming this works only when the PDF file is opened in-browser?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 26, 2019 0
Adobe Community Professional ,
Mar 27, 2019

Copy link to clipboard

Copied

That is correct.

Here are some other things you can do with PDF links (if you're using the browser's plug-in)...

Link to PDFs from HTML -- The PowerPoint FAQ

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 27, 2019 1
Adobe Community Professional ,
Mar 27, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Jon+Fritz+II  wrote

That is correct.

Here are some other things you can do with PDF links (if you're using the browser's plug-in)...

Link to PDFs from HTML -- The PowerPoint FAQ

Just to clarify, PDF parameters don't work with the built-in (browser API) readers in Chrome, Edge, Internet Explorer and Safari.   Unless you're using a really old browser,  plug-in support is gone.

.

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 27, 2019 1
Contributor ,
Mar 27, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Nancy+OShea  wrote

Just to clarify, PDF parameters don't work with the built-in (browser API) readers in Chrome, Edge, Internet Explorer and Safari.   Unless you're using a really old browser,  plug-in support is gone.

Guess there's not much point then, is there? My visitors will have more updated software than what I'd imagine the national average to be. In this rare case, that seems to be a negative; since it means less control going forward, instead of more.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 27, 2019 0
Adobe Community Professional ,
Mar 28, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Nancy+OShea  wrote

https://forums.adobe.com/people/Jon+Fritz+II   wrote

That is correct.

Here are some other things you can do with PDF links (if you're using the browser's plug-in)...

Link to PDFs from HTML -- The PowerPoint FAQ

Just to clarify, PDF parameters don't work with the built-in (browser API) readers in Chrome, Edge, Internet Explorer and Safari.   Unless you're using a really old browser,  plug-in support is gone.

.


When native PDF handling came out, absolutely nothing worked right, but there have been some updates to those native PDF handlers since their introduction.

I'm not sure about Safari (no Mac) but setting the page a PDF opens to works perfectly fine in Chrome, Edge, Vivaldi and Firefox with the built in readers under Windows 10. I haven't tested the other parameters, but it looks like zoom works in the majority of those browsers as well (Edge being the only one where it fails).

I imagine, as time passes, more support will be added and eventually, we'll have something fairly similar to the old Acrobat plug-in as far as feature sets are concerned.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2019 1
Contributor ,
Mar 28, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Jon+Fritz+II  wrote


When native PDF handling came out, absolutely nothing worked right, but there have been some updates to those native PDF handlers since their introduction.

I'm not sure about Safari (no Mac) but setting the page a PDF opens to works perfectly fine in Chrome, Edge, Vivaldi and Firefox with the built in readers under Windows 10. I haven't tested the other parameters, but it looks like zoom works in the majority of those browsers as well (Edge being the only one where it fails).

I imagine, as time passes, more support will be added and eventually, we'll have something fairly similar to the old Acrobat plug-in as far as feature sets are concerned.

Well that pretty much contradicts what led me to my last conclusion, so I'm back on board with the parameters. Especially if 1) they allow me to dynamically control what page the document opens at, and 2) support will only increase going forward.

Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2019 0
Adobe Community Professional ,
Mar 28, 2019

Copy link to clipboard

Copied

The only way to know for sure if those items will work, is to test in the actual browsers and devices you intend to support, and keep testing every time there's an update that affects the PDF handler.

Just make sure it's not a big deal if the parameter you want to use is ignored for those browsers that don't support it...

Something like a choose your own adventure book would be a bad plan if there's spotty support for page linking. However suggesting the information someone is looking for is on "Page 10 of the PDF" with a link to that page is fine. It won't ruin their experience if they click and are brought to page 1 instead, they would just need to scroll a bit.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 28, 2019 1
Contributor ,
Mar 30, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Jon+Fritz+II  wrote

The only way to know for sure if those items will work, is to test in the actual browsers and devices you intend to support, and keep testing every time there's an update that affects the PDF handler. Just make sure it's not a big deal if the parameter you want to use is ignored for those browsers that don't support it...

True, but as someone who's hung on to obsolete code for far too long for reasons like these, I now prefer getting on the bandwagon early.

I see it like stock trading. Sometimes you invest in something and the world moves in another direction. You pick your investments 😉 and this seems like a wise one, even if there are no guarantees ANY parameter will be better-supported (or dropped entirely) in the future.

And of course, now you made me want to write a Choose Your Own Adventure book. Damn you, I have no time!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 30, 2019 1
Guide ,
Mar 30, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/Jon+Fritz+II  wrote

Something like a choose your own adventure book would be a bad plan if there's spotty support for page linking. However suggesting the information someone is looking for is on "Page 10 of the PDF" with a link to that page is fine. It won't ruin their experience if they click and are brought to page 1 instead, they would just need to scroll a bit.

The internal PDF readers in Firefox, Chrome, Edge, and Opera (latest desktop versions) support links in a PDF without any issues. Chrome, Edge, and Opera can even deal with form elements, and both Chrome and Opera handle calculated fields as well (somewhat).

Making your own 'choose your adventure' book as a PDF would be rather pointless, except as an interesting personal experiment. Instead, use html/css/javascript. Something like Twine will do, or any of the interactive fiction authoring environments which will output directly to the web. PDF is just not the right format to do this in.

Btw, browsers do a pretty good job nowadays displaying static PDF files. For a more comfortable reading experience I prefer alternative PDF readers over Acrobat Reader (which is a piece of junk nowadays in my opinion, sorry...) such as PDFExchange Editor, Foxit, or Sumatra.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 30, 2019 0
LEGEND ,
Mar 26, 2019

Copy link to clipboard

Copied

Do you just straight-up vanilla-link to them directly, or can that link be somehow refined in ways I'm unaware of?

If you are working with plain, static .htm/.html files, yes, plain straight link to the PDF is pretty much your only option.

If, however, you are working with a server-side scripting language like ColdFusion or ASP or PHP, you have options.  Some will open in browser, some will force a download.  But as Nancy pointed out, I think most users would prefer to just download the PDF and open it in Acrobat.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 26, 2019 1