I am desperately trying to insert an image into an existing pdf with droidtext.
The original version of this project was made using iText. Thus, the code already exists and has been modified for Android.
What I do, I take an existing PDF as a background. Paste text and crosses at the indicated positions in this PDF file. Like filling out a form. This works very well so far without changing the code.
Now I want to set the image at the bottom of the page to sign the form. I used my original code and adapted it a bit. Which does not work at all. I tried to set the image at a specific position. Perhaps it was a mistake.
So I tried to do it in an “official” way. The image of Pengiuns.jpg is on the SD card.
try {
Document document = new Document();
File f=new File(Environment.getExternalStorageDirectory(), "SimpleImages.pdf");
PdfWriter.getInstance(document,new FileOutputStream(f));
document.open();
document.add(new Paragraph("Simple Image"));
String path = Environment.getExternalStorageDirectory()+"/Penguins.jpg";
if (new File(path).exists()) {
System.out.println("filesize: " + path + " = " + new File(path).length());
}
Image image =Image.getInstance(path);
document.add(image);
document.close();
} catch (Exception ex) {
System.out.println("narf");
}
.
, , PDF " " , .
. if().
.
, : , SD-, pdf ?
?
, pdf?
setAbsolutePosition (x, y).
Eclipse , , ?