PDF is an awesome format that allows people to view the document easily across different platform while staying consistent (it will look the same). However, viewing a large PDF on a website could be an issue when the size is too large. On top of that, web browser usually needs to download the whole PDF off before the user can actually sees it. It can be very inefficient and waste of time as the PDF gets larger and larger. A 20MB size of PDF with slower internet connection could take a min to download. Nowadays, people are impatient. User would not likes the idea of having to wait for a min or more before viewing a PDF. Here is where the lazy load comes into play. Lazy load is where it only trigger to load the contents that the user is requesting/got to. Contents that user never request/got to will not get load. This means two things. One is that it will help us to save some bandwidth for the server-side. Two is user will be able to view the PDF ALMOST immediately. The concept of Lazy load is wildly used on the internet. Because it allows the website to load faster (only load necessary contents) and performance is very important for high traffic website. So now, back to the topic, how can we leverage the benefit of lazy load with the PDF? We simply turn it into a HTML. It sounds simple. But turning a PDF into a HTML is a lot of work programmically. So today, I am going to show you guys a tool that will do the job. It is called JPDF2HTML5. This is one of the simplest tool that I can find online that will convert a large PDF to HTML. Please head over to their site to download the trial version of the tool, https://www.idrsolutions.com/jpdf2html5/downloads/trial/. You should be able to see a JAR file when you downloaded off from their site. The next thing you want to do is to run the following command,
For example, this is an example command that will convert a test.pdf and save the HTML to my desktop.
It is that simple.
Wrapping Up
Hopefully this guide has help you to convert your large PDF to HTML. Thank you for reading!
Resources
I’ll try to keep this list current and up to date. If you know of a great resource you’d like to share or notice a broken link, please let us know.
Comments