FPDF_RenderPageBitmap() gives crash on Unreal Engine Android Packaged Runtime.
ffreality opened this issue · comments
I am working on PDFium based Unreal Engine 5 runtime PDF import plugin. Windows side is working correctly but Android side crashes at packaged project when I use FPDF_RenderPageBitmap() function.
Crash log gives this error.
LogImageWrapper: Warning: PNG Warning: iCCP: known incorrect sRGB profile
This problem also occurs with this binary.
https://github.com/bblanchon/pdfium-binaries
Only working one is this but it is too old and for that reason I don't want to depend on it.
https://github.com/barteksc/PdfiumAndroid
Currently my plugin can
- extract texts of all pages,
- get texts from selected rectangle,
- get weblinks,
- get pages count,
- highlight,
- import both local and online pdfs
I can add pdf creation functions, too.
We need Bitmap rendering feature because world space rendering necessity of VR.
If you or someone can solve this problem, I can pay and share my plugin.
Also we can publish it on Unreal Marketplace to sell it (we can share profit).
Hi,
According to the source code, there is a problem with PNG:
https://github.com/chromium/pdfium/search?q=known+incorrect+sRGB+profile
In these lines:
https://github.com/chromium/pdfium/blob/3e36f68831431bf497babc74075cd69af5fd9823/third_party/libpng16/png.c#L2391-L2392
Is impossible to me check what really happen without a simple Android demo.
I even need a simple demo to include in my repository, like this:
https://github.com/paulocoutinhox/pdfium-lib/tree/master/sample-apple
If you have a simple android demo that do the same things as my ios demo (open document and get some data from the pdf) i can check and try help you.
And if you want any special support, my email is: paulocoutinhox@gmail.com
Thanks.
My project is a plugin for Unreal Engine rather than an Android app. If you have Unreal Engine and some exprience I can add you to my repo and send you a project but if you want a vanilla Android Studio app, it won't give a result because it works.
If problem occured while I was copying bitmap data to UTexture2D with FMemory:Memcpy() I could use libpng to clean profile. But it crash when I call FPDF_RenderPageBitmap()