Open a PDF file in an independent pdf reader

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
Sev Deloffre
Posts: 3
Joined: Fri Aug 17, 2018 5:22 pm

Open a PDF file in an independent pdf reader

Unread post by Sev Deloffre »

Hi Tim and Alexander,

I have defined some PDF file links in topics (for a Webhelp output)
How to make them open in a "reader" (or in another window) and not in the main window of the help file? and in the size I have defined in the PDF file properties?
I have seen that it is possible to define than for an internet link and also for topic link...
for information: (I have personalized the layout by using the HTML code, even if I'm not an expert of html language at all :? )

some info about what I have seen:
I have noticed that if you ctrl + click on the link in the output, the file is opened in an other window.
And I have also noticed that the size of the PDF file I initially defined in its properties (100% zoom when opening the pdf file) is not respected

Many thanks for explanations or solutions :D

Best regards
Séverine
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Open a PDF file in an independent pdf reader

Unread post by Tim Green »

You can't really influence this in links from web pages. It depends on the user's own settings for opening files from links in their browser. A link is a link, and the only change you can make as the author is in the target setting, whether it is supposed to open in a new tab/window or the current one. In some skins where opening within the skin is not possible this will always be a new tab/window anyway.

Web browsers are increasingly including PDF functionality of their own (Edge, Chrome), which is a terrible idea, but they love to default to opening the PDF file themselves. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Open a PDF file in an independent pdf reader

Unread post by Martin Wynne »

In theory, you should be able to control this on the server using the MIME type for the file:

application/pdf will cause the browser to do its default PDF thing.

application/octet-stream should cause the browser to download the file and ask the user what to do with it. If the user selects Open or Run, the file should be opened in the application set up for the file extension on the user's system.

Setting the MIME type on the server depends on the server config in the .htaccess file. Or if instead of linking to a PDF file directly, you link to a PHP file, you can use header('Content-Type: application/octet-stream'); in the PHP script before sending the PDF file.

(For ASP files, that's response.ContentType = "application/octet-stream";).

Martin.
Simon_Dismore
Posts: 205
Joined: Thu Jul 13, 2017 2:57 pm

Re: Open a PDF file in an independent pdf reader

Unread post by Simon_Dismore »

Tim Green wrote:Web browsers are increasingly including PDF functionality of their own (Edge, Chrome), which is a terrible idea
How is that terrible? (I can think of reasons why that's a mixed blessing, be interested to hear yours)
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Open a PDF file in an independent pdf reader

Unread post by Tim Green »

Simon_Dismore wrote:
Tim Green wrote:Web browsers are increasingly including PDF functionality of their own (Edge, Chrome), which is a terrible idea
How is that terrible? (I can think of reasons why that's a mixed blessing, be interested to hear yours)
Well, to begin with it provides yet another attack vector and a complex one at that (complexity always being the enemy of security). Then you get yet more propagation of more unnecessary rendering engines for a standard format that should really only have one standard rendering engine, further increasing the options for yet more Babylonian chaos and multiple unnecessary incompatibilities. And last but not least, PDF is a format that has no business being on the Web anyway, so putting support for it in browsers is simply counterproductive to start with. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply