pdfium-wasm icon indicating copy to clipboard operation
pdfium-wasm copied to clipboard

Support for rendering

Open maxkferg opened this issue 5 years ago • 2 comments

This projects looks great. We are interested in moving it forward, and in particular, adding rendering support. My initial thought was to create a new function in c that renders to a WebAssembly.Memory buffer, using the Pdfium function FPDF_RenderPageBitmap. The implementation would be similar to that createDocFromBuffer in avail.c

In javascript, we could then copy the bytes from WebAssembly.Memory to a canvas element. What are your thoughts on this approach?

maxkferg avatar Aug 17 '18 01:08 maxkferg

Hi Max, nice to meet you!

Yes, I'd love to see this - also sounds like a good direction. I think you can even do this completely in JS land - allocate the buffer and pass it to FPDF_RenderPageBitmap. As you have probably already discovered (#4), there are still some issue with the build and not all functions are working properly. How familiar are you with compiling stuff on Linux?

The entire build is dockerized, so it should be pretty straightforward to set it up and start tinkering with it. I believe some additional libraries (like jpeglib and zlib) would be required for some PDF files, as right now we only build the core PDFium code and ignore the rest.

If you are feeling comfortable tinkering with the build and have some time to hack on this, I'd love to offer my guidance. We can even set a short phone call to explain what I did so far.

urish avatar Aug 17 '18 11:08 urish

Hi,

It is working on my project here: https://github.com/paulo-coutinho/pdfium-lib

And you can test on web here: https://paulo-coutinho.github.io/pdfium-lib/

Consider donation on Sponsor button.

Thanks.

paulocoutinhox avatar Jan 31 '21 10:01 paulocoutinhox