javascriptnode.jspdfpdf-generationpdf.js

PDF.JS Preview large pdf file (> 200MB) on client side, that was sent from server side


I'm working with a pdf viewer, that will load a pdf file from server (nodejs) and then rendering on client side to allow user reading direct in my site.

I'm using pdf.js to rendering pdf file on client side. The problem is client side must download entire pdf file before they can parse and render it, so if the file is too large (~200MB in my case), user must wait for download entire 200MB.

I researched and i think i can solve this problem by 2 ways:

So what should i do to solve this problem? Thank you so much.


Solution

  • The best solution is to optimize all your PDF files for web.

    The default settings of pdf.js will load only the portion it needs to render.

    See here for more info.