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

TOPIC:

Eraser of PDF Ink 7 years 1 month ago #4884

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 962
  • Karma: 23
  • Thank you received: 87
make sure to rerender the page after adding the annotation..i've tested your code and it's working..
Bitmap bmAddnot = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
float[]rect = new float[]{0, 0, bmAddnot.getWidth(), bmAddnot.getHeight()};
PDFView m_view = m_vPDF.PDFgetView();
PDFVPage v_page = m_view.vGetPage(m_page_no);
Matrix mat = v_page.CreateInvertMatrix(m_view.vGetX(), m_view.vGetY());
mat.TransformRect(rect);
vpage.GetPage().AddAnnotBitmap(bmAddnot, true, rect);
m_vPDF.invalidate();


Attachments:

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

Eraser of PDF Ink 7 years 1 month ago #4886

  • el3ony
  • el3ony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
After I added m_vPDF.invalidate(); it still show nothing on screen just only PDF

I also tried with PDFReaderOldAct

Page page = m_doc.GetPage(0);
page.ObjsStart();
float[] rect = new float[4];
rect[0] = 0;
rect[1] = 0;
rect[2] = 100;
rect[3] = 100; page.AddAnnotBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher), false, rect);
m_doc.Save();
m_vPDF.invalidate();

there is no icon showing. What did I miss ?

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

Eraser of PDF Ink 7 years 1 month ago #4887

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 962
  • Karma: 23
  • Thank you received: 87
Are you trying with the demo project, or yours? if yours do you have the professional or premium license??

Does the method page.AddAnnotBitmap returns true?

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

Eraser of PDF Ink 7 years 1 month ago #4888

  • el3ony
  • el3ony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Both but I haven't use the license yet because I haven't finish my feature so I make a duplicate project and try with the same package name of demo project com.radaee.reader. If my understanding was right it should enable all of the feature like premium license right ?


addAnnotBitmap always return true with my duplicate project.

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

Eraser of PDF Ink 7 years 1 month ago #4889

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1037
  • Karma: 43
  • Thank you received: 62
Bitmap bmAddnot = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
float[]rect = new float[]{0, 0, bmAddnot.getWidth(), bmAddnot.getHeight()};
PDFView m_view = m_vPDF.PDFgetView();
PDFVPage v_page = m_view.vGetPage(m_page_no);
Matrix mat = v_page.CreateInvertMatrix(m_view.vGetX(), m_view.vGetY());
mat.TransformRect(rect);
vpage.GetPage().AddAnnotBitmap(bmAddnot, true, rect);
m_view.vRender(vpage);
m_vPDF.invalidate();
like this?
to be notice: Bitmap object must be ARGB_8888 format.

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

Eraser of PDF Ink 7 years 1 month ago #4891

  • el3ony
  • el3ony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Yes. Even when I created Bitmap object
I created like this Bitmap.createBitmap(bmWidth, bmHeight, Bitmap.Config.ARGB_8888);

Previous snippet code it's just for testing with default icon of project but it doesn't show anything.

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

Powered by Kunena Forum