RubyPDF Blog PDF pdfium.js is much faster than PDF.js

pdfium.js is much faster than PDF.js

The author of pdf2htmlex and vim.js, Lu Wang successfully ports PDFium to JS with Emscripten, and is much faster than PDF.js, amazing!

Hi all,

   I made an emscripten port of PDFium that allows you to read PDF files on the web:

   http://coolwanglu.github.io/PDFium.js/
   http://coolwanglu.github.io/PDFium.js/viewer/

   The first link is mainly for profiling, and the 2nd one is adapted to the PDF.js UI framework. It’s working, but also experimental, some features are missing.

   Profiling shows that it’s much faster than PDF.js: 
  
   https://docs.google.com/spreadsheets/d/1s90JhBjpcbc8FoGruLFzKxaQ-cpKT8qmHgBUsCH9PXY/edit#gid=0

   
   Basically the porting was quite easy, except for two issues I found:

   While registering some functions to freetype, there are cast of function pointers into incompatible ones. This is undefined behavior in the C standard, and it is not supported by emscripten — although it does work for most C compilers. I’ve made a fix of this. Not sure if you need this.
   Another issue would be, I wonder if there could be an option to disable the JS engine. In this port V8 is not needed at all.


   Thanks!


   regards,
   – Lu Wang

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.