PDF files come in different sizes. We have seen files as normal as 1-2MB and upto 100s of MB. Serving big files is a challenge that needs to be handled in a managed way. Luckily PDFs can have Linearized structure which enables Partial loading feature.
What is Partial Loading of PDF?
“Web Optimized“ , “PDF Fast Web View” are general terms for “Linearized“ – technical term and was introduced in PDF 1.2 . This allows “Partial Loading“ to take place when PDF is loaded.
PDFs can be loaded in chunks much like videos and music files. It’s like streaming a PDF file. You can jump to mid section of PDF and just that portion will be loaded to display the PDF pages. This is really handy when viewing big PDF files in web.
Technically linearized PDF file a format of PDF file enabling faster viewing of PDF in Internet. A Linearized PDF file will have data that enables a byte-streaming server to serve PDF file one page at a time. Thus if the PDF is not Linearized or the server doesn’t have byte-streaming, the whole PDF will be served instead of a part.
How to enable Partial Loading in PDF?
Have a Linearized PDF
Normally all PDF export tools export PDF in web format. And usually they are linearized to be partially loaded. Make sure your PDF is exported for Web(not for print).
Have a Byte-streaming server
Make sure your server supports byte-streaming and is enabled.
Why is my PDF partial loading not working properly?
Based on our years of experience serving PDFs through our jQuery and WordPress flipbook plugins. We have come across many sittuation that hamper partial loading.
This is very common, provided compression is common. Do not zip your PDF. You can create a special rule in your host or .htaccess to exclude pdf from compression. Remember, PDF is already a compressed file format. Further compressing doesn’t reduce the size, but rather blocks partial loading feature.
Partial Loading not supported by server!
This case is common in nginx server. nginx server by default do not have partial loading as efficient as Apache, thus it can be a hindrance in serving PDFs in partial loading. The remedy is to serve the PDFs using Apache and other files with nginx proxy.
You have exported PDF with web export setting. Yet your exported may not create a linear PDF. We use WorkerPDF to convert the PDFs to ebook export.
Some server do not provide enough headers. So we need to add it.
Update this under S3 ->Buckets -> Permissions -> CORS
We will keep adding any further finding to this topic. Till then Happy Flipping!!