- Posts: 80
- 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
Bitmap annotation not added in PDF.
IP: 192.168.0.71
11 years 3 months ago #8007
by moontech
Replied by moontech on topic Bitmap annotation not added in PDF.
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?
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?
IP: 192.168.0.71
11 years 3 months ago - 11 years 3 months ago #8009
by radaee
Replied by radaee on topic Bitmap annotation not added in PDF.
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.
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.
Last edit: 11 years 3 months ago by .
IP: 192.168.0.71
11 years 3 months ago #8017
by moontech
Replied by moontech on topic Bitmap annotation not added in PDF.
It added by mistake. We are not using it every time. Invoking only once after m_doc.Open().
IP: 192.168.0.71
11 years 3 months ago #8018
by radaee
Replied by radaee on topic Bitmap annotation not added in PDF.
the simplest debug is:
set debug point in Document.SetCache();
and check it invoked times.
set debug point in Document.SetCache();
and check it invoked times.
IP: 192.168.0.71
11 years 3 months ago #8024
by moontech
Replied by moontech on topic Bitmap annotation not added in PDF.
Yes, we have checked that. It invoked only once.
IP: 192.168.0.71
11 years 3 months ago #8028
by radaee
Replied by radaee on topic Bitmap annotation not added in PDF.
i have no more ideas, we tested demo project many times, and no problems found.
Time to create page: 0.384 seconds