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

Add Image on existing PDF file

More
IP: 103.211.53.63 7 years 9 months ago #13938 by vkjha
Hi,

I need to add image on PDF file, I have used the code link:-

Document pdf_doc = new Document();
pdf_doc.Create(Environment.getExternalStorageDirectory() + getString(R.string.teli_dir) + "/test.pdf");
int page_no = 1;
for (File f: allFiles) {
if (f.getName().contains("jpg")){
Page page = pdf_doc.NewPage(page_no++,210,297);

BitmapFactory.Options bmpOptions = new BitmapFactory.Options();
bmpOptions.inJustDecodeBounds = true;
bmp = BitmapFactory.decodeFile(f.getAbsolutePath(), bmpOptions);
PageContent pageContent = new PageContent();
pageContent.Create();
pageContent.GSSave();
com.radaee.pdf.Matrix mat = new com.radaee.pdf.Matrix(250, 250, 0, 0);
pageContent.GSSave();
pageContent.GSSetMatrix(mat);
Document.DocImage docimage = pdf_doc.NewImage(bmp, true);
ResImage rimage = page.AddResImage(docimage);
pageContent.GSSave();
mat.Destroy();
pageContent.DrawImage(rimage);
pageContent.GSRestore();
page.AddContent(pageContent, false);
pageContent.Destroy();
page.Close();
}
}
pdf_doc.Save();
pdf_doc.Close();

but when i open and load existing file on Document then application is going to crash.

Please check this code.

Thanks
More
IP: 212.97.62.176 7 years 9 months ago #13944 by Davide
Hi,
can you reproduce the issue with the demo project? With all the pdfs?
If yes, can you please send us a pdf with the issue?

DId you follow this article : www.radaeepdf.com/support/knowledge-base?view=kb&kbartid=27 ?
Time to create page: 0.381 seconds
Powered by Kunena Forum