Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #12121 Reply



    I need to display multiple PDFs with swipe navigation between them. Therefore I put ReaderViews in a ViewPager, quite a simple setup. It’s a single ViewPager inside MainActivity. Relevant snippets (in Kotlin):

    But I have two issues:

    1) Some PDFs contain embedded fonts and take a long time to display. This time gets very long when two PDFs are loaded from disk simultaneously, e.g. at startup the ViewPager instantiates items 0 and 1.

    2) If the user swipes faster than the PDFs are displayed, memory usage starts to climb, if the user swipes fast enough and often enough up and until OOM. This seems not to be a leak because memory usage returns to baseline when the user pauses long enough for the PDF display to catch up.

    My guess is that public void openData(byte[] data, int len, String password) starts loading from disk in background tasks and public void clear() only clears up after the background tasks have finished, which leads to too much memory consumption if the user swipes fast enough.

    Any pointers how to solve this issues?


    #12212 Reply

    Dr. Plug

    Hello Holger,

    Thank you for your patience.
    It seems that the reason of the issue is rendering.
    Our PlugPDF SDK do not use memory for pages that do not need to be drawn.
    However, you can not forcibly free the memory while some page being drawn.
    If you are not using the latest version, can you test it again with the latest version?
    A few months ago, we improve the memory issue.

    Best regards,

    PlugPDF Support

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Multiple Readerviews
Your information: