ajaxpdfbinaryframeworks

How to display PDF in parts on a web page?


Here is what I am trying to achieve. I have a server which dynamically generates PDFs based on some parameters users provide on my web site. The PDFs can be large (~10-20MB) which poses two problems: it is slow for the user and it eats up bandwidth on my server which is running on Amazon Web Services. What I have empirically found however is that most users only look at a few pages of the PDF. So, I want to allow the PDF to be loaded one page at a time and then a user scroll would async request the next page.

I realize that I could modify my server code to generate multiple pdfs instead of one, but that is turning out be very time consuming. Hence, I wanted to ask if anybody has ever run into this? Maybe there is a way to retrieve the PDF from the server as just binary data and then having some way of displaying the PDF in chunks.

I am still in the initial phases of building my web site, so I would be open to using any language/framework/tool that can do this.


Solution

  • You can try converting PDF's from HTML files. So you can create separate HTML files of each page of your document and then export into PDF whatever pages you need. have a look at this: http://www.html2pdf.fr/en/default or you can use FPDF or whatever class you can find out there.