Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC:

Cache for PDFViewThumb 4 years 7 months ago #14555

  • thiagopelikan
  • thiagopelikan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 0
I need to use cache for PDFThumbView, I found that there is an property called save_thumb_in_cache at Global, but It seems that it is only implemented for PDFGridItem. Is there any sample on how to implement cache for PDFThumbView?

Tks,
Thiago Pelikan

Please Log in or Create an account to join the conversation.

Cache for PDFViewThumb 4 years 7 months ago #14556

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
the bitmap cache is generated at class PDFVCache, function "RenderThumb".

Please Log in or Create an account to join the conversation.

Cache for PDFViewThumb 4 years 7 months ago #14563

  • thiagopelikan
  • thiagopelikan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 0
Inside PDFViewThumb there is a method vDraw and a line:
m_thread.start_render_thumb(vpage);

I think this is the line that calls the RenderThumb method for rendering the page. The problem is that everytime I scrolls to the right and then scroll back to the place I was, the cache goes null again. Check my attached image with log. Could you help me understand what is happening?
Attachments:

Please Log in or Create an account to join the conversation.

Cache for PDFViewThumb 4 years 7 months ago #14564

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
system ram(memory) has limit size. so, it is impossible to load all pages in memory. imaging a pdf file has 500 pages...
we only load pages that display on screen, and always unload pages off screen to free memory usage.

Please Log in or Create an account to join the conversation.

Cache for PDFViewThumb 4 years 7 months ago #14565

  • thiagopelikan
  • thiagopelikan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 0
Sure, I undertand I agree with you that this is a good thing. My question is If there is somehow a way to save the rendered page as a file and only load the file instead of rendering it all again.

Tks

Please Log in or Create an account to join the conversation.

Cache for PDFViewThumb 4 years 7 months ago #14566

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
you shall make file name like "pdf_file_name_pageno.png".
in "render_thumb" method, you can create a Bitmap object, and then draw DIB to Bitmap object using m_dib.DrawToBMP().
at last save bitmap object to file.
at begin of "render_thumb" method, you shall check is "pdf_file_name_pageno.png" exists?
if exists, you can simply load from this file to Bitmap object, and create a DIB object, using BMP.DrawToDIB draw to DIB object instead of page rendering.
this will make lots file, so you may need delete all cache file when PDFView closed.

Please Log in or Create an account to join the conversation.

Last edit: by radaee.
  • Page:
  • 1
  • 2
Powered by Kunena Forum