Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Page Curl in MuPDF

I have two libraries one is MuPDF to view PDF files in android and second is pageCurl to implement the page curl effect, but it works for bitmaps. Now, I have no idea how can i integrate both of these to get page curl effect in PDF files, opened by MuPDF. If any one has already implemented this or knows about some link then please help me.

Thanks

like image 231
Ali Imran Avatar asked Jan 21 '13 11:01

Ali Imran


1 Answers

As far as I know there's no simple way to accomplish this. I made a real world app for a wide spread national newspaper: the only way seems to work with bitmaps. They used server side pdf for iOS devices and jpg bitmaps for the Android counterpart.

Keep in mind that working with large bitmaps is a pain in android. That's the reason why pdf viewers renders them in chunk: if you scroll too much, in zooming mode, the high resolution chunks already loaded in memory keep being garbage collected and lost. Test it with whatever pdf implementation (even muPDF) you choose.

2 bitmaps at once (front page and back page, for example) with resolutions of say about 1200x800 eat up the whole app heap memory causing the infamous unrecoverable OutOfMemory exception. Every device has a fixed (and different) amount of heap memory to use for the objects in memory and suffer max allocation limitations too.

My suggestion is:
save your time and change implementation to prerendered images from pdf (server side the best if possible, or prerender directly on device) and manage low memory limited device with different resolution ones.

I'm an Android enthusiast developer but I'm waiting ages for some all-pdf components that could accomplish what iOS devices already do flawlessly. Good luck.

like image 180
Alessandro Alessandra Avatar answered Oct 15 '22 14:10

Alessandro Alessandra