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 #7966

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
yes, only exists at last beta or later.

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

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

  • moontech
  • moontech's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
We can't found above methods.
And we need code for addBitmap annotation in PDF using Bitmap object.
So send actual code which work for Bitmap annotation.

Note:
In our application we used three types annotation.
1 Text
2 ink
3 Bitmap

above two working well but bitmap annotation not added in PDF.
Some time annotation added with blank bitmap.
means bitmap not displaying on PDF but rectangle of bitmap displaying.

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

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

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
here is piece codes in PDFReader:
PDFPos pos = m_view.vGetPos(touch_x1, touch_y1);
PDFVPage vpage = m_view.vGetPage(pos.pageno);
Page page = vpage.GetPage();
if( page != null )
{
Matrix mat = vpage.CreateInvertMatrix(m_view.vGetX(), m_view.vGetY());
float rect[] = new float[4];
rect[0] = touch_x1;
rect[1] = touch_y1;
rect[2] = touch_x2;
rect[3] = touch_y2;
mat.TransformRect(rect);
page.AddAnnotBitmap(m_icon, true, rect);
mat.Destroy();
m_view.vRenderSync(vpage);
}
where touch_x1, touch_y1, touch_x2, touch_y2 is in screen x,y.
touch_x2 > touch x1 and touch_y2 > touch_y1

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 #7974

  • moontech
  • moontech's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
We tried above code but still same issue.
We are using code as below.

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();

Please let us know what modification it needs.

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

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

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
m_doc.SetCache(Global.tmp_path + "/temp.dat"); can't invoke multi-times.
only once m_doc.SetCache can be invoked, for each Document.

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

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

  • moontech
  • moontech's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 80
  • Thank you received: 0
Now invoking this only once after this
m_doc.Open(val, null);

Still same problem..

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

Powered by Kunena Forum