- Posts: 19
- Thank you received: 0
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
Reading annotations not created by Radaee
IP: 37.214.46.4
5 years 7 months ago #15188
by MaxM
Reading annotations not created by Radaee was created by MaxM
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?
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?
IP: 111.196.243.34
5 years 7 months ago - 5 years 7 months ago #15189
by radaee
Replied by radaee on topic Reading annotations not created by Radaee
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.
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.
Last edit: 5 years 7 months ago by radaee.
IP: 37.214.48.59
5 years 7 months ago #15201
by MaxM
Replied by MaxM on topic Reading annotations not created by Radaee
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?
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?
IP: 111.196.243.34
5 years 7 months ago #15202
by radaee
Replied by radaee on topic Reading annotations not created by Radaee
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.
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.
IP: 178.121.66.228
5 years 7 months ago #15203
by MaxM
Replied by MaxM on topic Reading annotations not created by Radaee
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.
1. Matrix parameter pass to page is not correctly.
2. Render target is freed, for example Bitmap object recycled.
IP: 111.196.243.34
5 years 7 months ago - 5 years 7 months ago #15204
by radaee
Replied by radaee on topic Reading annotations not created by Radaee
please test on:
Code:
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);
Last edit: 5 years 7 months ago by radaee.
Time to create page: 0.436 seconds