Hi, I need to save some pictures to new PDF. This script bellow create new PDF file, but without images. I have seen your example here in docs. it the same code, what i do wrong? or is it a bug. I use the radaee version 3.11 for android.
Thanks for answer.
B.r. Tom
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();