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

TOPIC:

Bitmap annotation not added in PDF. 9 years 4 months ago #8007

  • moontech
  • moontech's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
We can't send complete project.
We are using below code for graphic annotation:

public void graphicannotation(Bitmap bitmap)
{
m_doc.SetCache(Global.tmp_path + "/temp.dat");
int c_page = Constant.currentpage;
pa = m_doc.GetPage(c_page);
pa.ObjsStart();
PDFVPage vpage = m_rPDF.m_view.vGetPage(c_page);
float[] rect = { 200, 200, (200 + bitmap.getWidth()),
(200 + bitmap.getHeight()) };
pa.AddAnnotBitmap(bitmap, true, rect);
float m_ratio = ((float) m_doc.GetPageHeight(c_page))
/ ((float) m_doc.GetPageWidth(c_page));
Matrix mat = new Matrix(m_ratio, -m_ratio, 0,
m_doc.GetPageHeight(c_page) * m_ratio);

pa.RenderToBmp(bitmap, mat);
m_rPDF.m_view.vRenderSync(vpage);
pa.Close();
mat.Destroy();
bitmap.recycle();
}


To save pdf:

m_rPDF.PDFEndAnnot();
savedailog(); (here it updates file name)
boolean a = m_rPDF.PDFSave();

onResume() we are not using any object or method of this library.

Can you suggest anything form this?

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

Bitmap annotation not added in PDF. 9 years 4 months ago #8009

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
this line has problem:
m_doc.SetCache(Global.tmp_path + "/temp.dat");
it invoked every time when function "graphicannotation" call.
to be sure: only once of m_doc.SetCache method invoked.

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

Last edit: by .

Bitmap annotation not added in PDF. 9 years 4 months ago #8017

  • moontech
  • moontech's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
It added by mistake. We are not using it every time. Invoking only once after m_doc.Open().

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

Bitmap annotation not added in PDF. 9 years 4 months ago #8018

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
the simplest debug is:
set debug point in Document.SetCache();
and check it invoked times.

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

Bitmap annotation not added in PDF. 9 years 4 months ago #8024

  • moontech
  • moontech's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
Yes, we have checked that. It invoked only once.

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

Bitmap annotation not added in PDF. 9 years 4 months ago #8028

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
i have no more ideas, we tested demo project many times, and no problems found.

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

Powered by Kunena Forum