Jump to content

PDF to URL

Ginka
Go to solution Solved by mariushm,

How it works will depend on how the people have their computers and browsers configured.

 

For example, by default Firefox will open PDF files directly without downloading them completely, using its own internal PDF reader. However, if you install programs like Adobe Acrobat Reader or Adobe Acrobat Pro or other programs, they may install a plugin in the browser and change the default to use their own renderer instead of the built-in pdf reader. It will still show up inside the browser, and will not download on user's computer but may look different. 

Also, user can choose to force download to open in an external PDF viewer and for example, I have it set like that because I find Adobe Acrobat Pro very convenient and renders things much better than the default Firefox renderer.

 

Some notes... if you want the reader to only download parts of your pdf as needed, then you also have to save your PDF file as "web optimized", the internal layout of the pdf file must be a bit different compared to saving as a regular file, which would use higher compression and other things. 

 

As an analogy, it's sort of like "solid compression" or regular compression, where in solid compression mode files can be compressed much better but in order to extract a single file out of the archive, the decompressor has to extract ALL the files up to the desired file while with regular compression,the decompressor can skip to a random file within an archive.

 

 

how to put them in html .... see  http://mozilla.github.io/pdf.js/

 

but to make a pdf show up on a page the code is as simple as this :

 

<object data="http://yoursite.com/the.pdf" type="application/pdf" width="750px" height="750px">
    <embed src="http://yoursite.com/the.pdf" type="application/pdf">
        <p>This browser does not support PDFs. Please download the PDF to view it: <a href="http://yoursite.com/the.pdf">Download PDF</a>.</p>
    </embed>
</object>

 

the embed tag should work by default, if it's not supported then it should fallback to object (or the other way around)

Some browsers won't accept either, and that's where that pdf.js  link comes in play ... your page loads that, which then reads the pdf file and renders it as html on the users' computer on the fly.

 

Hey guys :)

 

I need to convert two pdf to html links so it can be accessed by anyone. Is it possible ? How to do it ?

 

Thx !

Link to comment
Share on other sites

Link to post
Share on other sites

Literally all major browsers have a PDF engine now, right? So I don't see the issue ;) 

PC Specs - AMD Ryzen 7 5800X3D MSI B550M Mortar - 32GB Corsair Vengeance RGB DDR4-3600 @ CL16 - ASRock RX7800XT 660p 1TBGB & Crucial P5 1TB Fractal Define Mini C CM V750v2 - Windows 11 Pro

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, LukeSavenije said:

can't word do that?

I have no Idea.

Can we even open a pdf in words without breaking the text layout ?

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Ginka said:

I have no Idea.

Can we even open a pdf in words without breaking the text layout ?

well, sometimes word breaks the layout, but they can open pdf's and export it as a html. just try it first I would say

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, NelizMastr said:

Literally all major browsers have a PDF engine now, right? So I don't see the issue ;) 

Lol I have no idea what you are talking about. Would you be kind of to explain ?

Somebody gave me those files asking me if I could do it ^^

Link to comment
Share on other sites

Link to post
Share on other sites

Adobe Acrobat Pro can export to HTML and other formats.

 

LibreOffice Writer should be able to open PDF files and potentially export to some formats.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Ginka said:

Lol I have no idea what you are talking about. Would you be kind of to explain ?

Somebody gave me those files asking me if I could do it ^^

you can open pdfs in most browsers these days. including edge, chrome(ium) and firefox

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, LukeSavenije said:

you can open pdfs in most browsers these days. including edge, chrome(ium) and firefox

Oh that is what you meant.

What I want to do is give that PDF link to other people over the internet, and let them see my pdf without having to download it on their computer.
 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Ginka said:

Oh that is what you meant.

What I want to do is give that PDF link to other people over the internet, and let them see my pdf without having to download it on their computer.
 

yeah, then html is a better choise. tried word already?

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Ginka said:

Oh that is what you meant.

What I want to do is give that PDF link to other people over the internet, and let them see my pdf without having to download it on their computer.
 

That's how today's browsers do it with their PDF engines. They render the file client side, but it stays server side.

PC Specs - AMD Ryzen 7 5800X3D MSI B550M Mortar - 32GB Corsair Vengeance RGB DDR4-3600 @ CL16 - ASRock RX7800XT 660p 1TBGB & Crucial P5 1TB Fractal Define Mini C CM V750v2 - Windows 11 Pro

 

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, NelizMastr said:

That's how today's browsers do it with their PDF engines. They render the file client side, but it stays server side.

Mind to help me figure out how to create that link ? ^^

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Ginka said:

Mind to help me figure out how to create that link ? ^^

I'm not a developer, so I can't help you with that, but afaik a link to a PDF file will always trigger the PDF engine on a browser and only offer it as a file download when it can't read a PDF.

PC Specs - AMD Ryzen 7 5800X3D MSI B550M Mortar - 32GB Corsair Vengeance RGB DDR4-3600 @ CL16 - ASRock RX7800XT 660p 1TBGB & Crucial P5 1TB Fractal Define Mini C CM V750v2 - Windows 11 Pro

 

Link to comment
Share on other sites

Link to post
Share on other sites

How it works will depend on how the people have their computers and browsers configured.

 

For example, by default Firefox will open PDF files directly without downloading them completely, using its own internal PDF reader. However, if you install programs like Adobe Acrobat Reader or Adobe Acrobat Pro or other programs, they may install a plugin in the browser and change the default to use their own renderer instead of the built-in pdf reader. It will still show up inside the browser, and will not download on user's computer but may look different. 

Also, user can choose to force download to open in an external PDF viewer and for example, I have it set like that because I find Adobe Acrobat Pro very convenient and renders things much better than the default Firefox renderer.

 

Some notes... if you want the reader to only download parts of your pdf as needed, then you also have to save your PDF file as "web optimized", the internal layout of the pdf file must be a bit different compared to saving as a regular file, which would use higher compression and other things. 

 

As an analogy, it's sort of like "solid compression" or regular compression, where in solid compression mode files can be compressed much better but in order to extract a single file out of the archive, the decompressor has to extract ALL the files up to the desired file while with regular compression,the decompressor can skip to a random file within an archive.

 

 

how to put them in html .... see  http://mozilla.github.io/pdf.js/

 

but to make a pdf show up on a page the code is as simple as this :

 

<object data="http://yoursite.com/the.pdf" type="application/pdf" width="750px" height="750px">
    <embed src="http://yoursite.com/the.pdf" type="application/pdf">
        <p>This browser does not support PDFs. Please download the PDF to view it: <a href="http://yoursite.com/the.pdf">Download PDF</a>.</p>
    </embed>
</object>

 

the embed tag should work by default, if it's not supported then it should fallback to object (or the other way around)

Some browsers won't accept either, and that's where that pdf.js  link comes in play ... your page loads that, which then reads the pdf file and renders it as html on the users' computer on the fly.

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Ginka said:

So I made this :
https://drive.google.com/file/d/1V2R8OzI6pPQvw_i1hn8GMwim1lvnPW4Q/view
 

Will people without a google account be able to see it ? Like everyone ? 

Yes, everyone can see that, including those without Google accounts.

It also opens up in Google Drive's built in PDF reader so it should work on basically all devices, even those who do not have a built in PDF reader (which is essentially just Internet Explorer these days).

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, LAwLz said:

Yes, everyone can see that, including those without Google accounts.

Ok so It should be alright then.

 

Thx all !!

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×