pdfium-lib
pdfium-lib copied to clipboard
Update emscripten to version 3
Hi,
I need some help to update this project to use Emscripten version 3+.
I already make the port in the branch: https://github.com/paulocoutinhox/pdfium-lib/tree/emscripten.
But when i try load any PDF, it throws this error:
![image](https://user-images.githubusercontent.com/395096/170083059-3c44f5d0-8990-4b5c-921d-f94bb5760c2d.png)
Related code:
console.log('INIT 1');
FPDF.Init(); // <- here is the problem
console.log('INIT 2');
Can anyone help me debug/understand?
Thanks.
Hi guys,
@cetinsert @Priestch @quincarter can you try help me finish it when you have time?
Thanks.
I'll see if i can do something with this. I'll play with this over the weekend.
@paulocoutinhox I'm also looking into this. The main problem seems to be the memory allocator. PDFium uses ASLR but Emscripten 3 does not support giving a hint address when calling mmap, which is needed to do ASLR. See https://github.com/emscripten-core/emscripten/blob/1bbb5f8dea4422768bdc9a9a44ce8a9eb6dd39c9/system/lib/libc/emscripten_mmap.c#L119
I'm working on creating a standalone WASM build so that we can use it in a Go runtime, and so far it's not going too well :crying_cat_face: New problems every step of the way.
We could look into disabling ASLR in PDFium so that it can call mmap and allocate the memory pages it needs.
Hi,
I will refactor all and remake a lot of things in this project. And when i start it, i will change this too.
Im only finishing another open source project that is a requirement for me.
Stay tuned here and feel free to donate to help project development.
Thanks.
Hi @paulocoutinhox,
I'm just curious, but what are your plans regarding this ticket and the remake? Because I really want to get this WASM pdfium build to work correctly, but the way I'm seeing it now, it totally depends on someone making a patch for pdfium to fix up the memory allocation, and it doesn't really have to do with this or any other pdfium build project.
@paulocoutinhox check this out: https://github.com/bblanchon/pdfium-binaries/issues/28#issuecomment-1293957584
Hi,
All problems was fixed in new release.
You can check here: https://github.com/paulocoutinhox/pdfium-lib/releases/tag/5407
The demo is here: https://pdfviewer.github.io/
Feel free to donate to help project development.
Thanks.