Add Image on existing PDF file - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Add Image on existing PDF file

Add Image on existing PDF file 4 months 2 weeks ago #13938

  • vkjha
  • vkjha's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
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

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

Add Image on existing PDF file 4 months 2 weeks ago #13944

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Karma: 17
  • Thank you received: 65
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 ?

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

  • Page:
  • 1
Powered by Kunena Forum