Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

3.2 Can't add bitmap

More
IP: 192.168.0.71 11 years 5 months ago #8116 by hellofaxstave
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?
More
IP: 192.168.0.71 11 years 5 months ago #8131 by radaee
Replied by radaee on topic 3.2 Can't add bitmap
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.
Time to create page: 0.467 seconds
Powered by Kunena Forum