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

TOPIC:

Reading annotations not created by Radaee 3 years 8 months ago #15188

  • MaxM
  • MaxM's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
Hi Radaee, there is a problem reading annotations produced by another library. Loading this file crashes: "Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe8 in tid 17778 (by.mrsoft.mrdoc)".
Features:
1.If all types of annotations (graphic, text, sound) are on one pdf - a fall occurs.
2. If one annotation is graphic, everything is fine.
3. If there are two or more graphic annotations - fall.
4. If text or sound - drop
There is a suspicion that the error occurs in the GetAnnot (int index) method of the Page class.
Tell me what could be the problem or where to look for it?
Attachments:

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

Reading annotations not created by Radaee 3 years 8 months ago #15189

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
we have not experience crashed issue.
so, we think 2 maybe reason:
1. you are using old version.
2. you have deleted annotation, and get annotation from deleted index
for example, there is 10 annotations in a page, you deleted 2 and 3, then you get annotation index at 9.

there is a rendering issue, because ink annotation has contour moveto, and shall draw dot at move position.
the circle direction not same to round line header, we shall fix rendering issue.
The following user(s) said Thank You: MaxM

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

Last edit: by radaee.

Reading annotations not created by Radaee 3 years 8 months ago #15201

  • MaxM
  • MaxM's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
Hi, corrected my code a bit. Removed the call to annotations - the crashes stopped, but ... Now the page with these annotations is not rendered, just a blank white page, which is placed at the end of the document.

Checked your 2 versions:
1. Updated version - did not help.
2. I do not refer to annotations - the result is the same.

What could it be, do you have any thoughts or suggestions?

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

Reading annotations not created by Radaee 3 years 8 months ago #15202

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
there is too many reasons cause render blank pages:
1. matrix parameter pass to page is not correctly.
2. page object has been closed.
3. document closed before page object rendering.
4. render target is freed, for example Bitmap object recycled.
The following user(s) said Thank You: MaxM

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

Reading annotations not created by Radaee 3 years 8 months ago #15203

  • MaxM
  • MaxM's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
Tell me where you can see how it works or check:
1. Matrix parameter pass to page is not correctly.
2. Render target is freed, for example Bitmap object recycled.

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

Reading annotations not created by Radaee 3 years 8 months ago #15204

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
please test on:
Global.init();
Document doc = new Document();
doc.Open("/sdcard/test.pdf", "");
float pw = doc.GetPageWidth(0);
float ph = doc.GetPageHeight(0);
Page page = doc.GetPage(0);
float scale = 2;
int iw = (int)(pw * scale);
int ih = (int)(ph * scale);
Matrix mat = new Matrix(scale, -scale, 0, ih);
Bitmap bmp = Bitmap.createBitmap(iw, ih, ARGB_8888);
bmp.erase(-1);
page.renderToBmp(bmp, mat);
mat.destroy();
page.Close();
doc.Close();

bmp.compress(PNG);
The following user(s) said Thank You: MaxM

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

Last edit: by radaee.
Powered by Kunena Forum