Google+ Rendering PDF reports as HTML for mobile devices

Peter Bromberg's .NET Blog All Things Programming

Rendering PDF reports as HTML for mobile devices

7. July 2017 05:58 by admin in

One of the big problems with things like Report Server and the RDLC ReportViewer control is being able to render PDF reports in mobile browsers. If you can convert these to HTML on the fly with the right library, mobile browsers will happily render the HTML.

One such library is PDF.js  It is extremely easy to install and you can get a PDF report as HTML.

You can set it up as follows:

  1. Download

  2. Extract the ZIP file (a directory called "pdf.js-gh-pages" will be created).

  3. Copy the following directories to your website:

    • pdf.js-gh-pages/build/
    • pdf.js-gh-pages/web/
      The web/ directory contains a 1 MB PDF file called "compressed.tracemonkey-pldi-09.pdf". This file is only used as an example for the demo and can safely be removed.
  4. If you want to open a PDF from your website with PDF.js, simply link to the viewer and pass the location of the PDF file. For example:

    <a href="/web/viewer.html?file=%2Fyourpdf.pdf">Open yourpdf.pdf with PDF.js</a>

Add comment

  Country flag