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

TOPIC:

3.2 Can't add bitmap 9 years 4 months ago #8116

  • hellofaxstave
  • hellofaxstave's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 1
  • Thank you received: 0
I am trying to upgrade from v2 to v3.2 and now I am unable to add Bitmaps to Pages. I have a Professional license which has been enabled. Here is what I see:

b = BitmapFactory.decodeFile(filePath, options); //Bitmap successfully loads
Document m_doc = new Document();
m_doc.Open(pdf.getAbsolutePath(), null); //static file path for temp file, is valid

//m_doc has a large negative hand_val on Android v5 which seems wrong
//on Android v4 m_doc has a large positive hand_val which seems correct

Page page = m_doc.GetPage(0); //this works
float dpix = m_doc.GetPageWidth(0);
float dpiy = m_doc.GetPageHeight(0);
dpix = Math.round((disp_w * 72) / dpix); //85.0
dpiy = Math.round(((disp_h - 50) * 72) / dpiy); //103.0

int w = (int) ((dpix * m_doc.GetPageWidth(0)) / 72); //720
int h = (int) ((dpix * m_doc.GetPageHeight(0)) / 72); //1184

Matrix mat = new com.radaee.pdf.Matrix(dpix / 72, -dpix / 72, 0, (dpix * m_doc.GetPageHeight(0)) / 72);
DIB dib = new DIB();
dib.CreateOrResize(w, h);

page.RenderPrePare(dib);
float rect[] = { 0, 0, m_doc.GetPageWidth(0), m_doc.GetPageHeight(0) };
boolean add_bitmap = page.AddAnnotBitmap(b, false, rect); // **** returns false! *****

// now i save and close the document, but it's just a blank document



I have completely replaced the old version of PDFViewer with the new one including the libs directory. What do I need to change?

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

3.2 Can't add bitmap 9 years 4 months ago #8131

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
ver 3.2 has example to show how to add bitmap anotations.
just click "Stamp" button, and then drag on screen.

AddAnnotBitmap need conditions:
1. Document.SetCache() invoked, and only once for each Document, and do not share same cache file name for different Documents at one time.
2. Bitmap must be RGBA32 pixel format.
3. professional or premium license actived.

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

  • Page:
  • 1
Powered by Kunena Forum