0
ファイルコードを使用して、追加モードでpdfファイルを開きます。私はどのようにしてイメージを既存のpdfファイルにアンドロイドで追加することができますか?
String FILE = ROOT + "/PDF/" + "DemoLogix.pdf";
PdfWriter.getInstance(document, new FileOutputStream(FILE, true));
document.open();
しかし、私はそれはまだない作品を行い、次のコード
PdfPTable table5 = new PdfPTable(new float[]{1});
Bitmap bitmap = BitmapFactory.decodeFile(path); //path is where image is stored.
ByteArrayOutputStream stream1 = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream1);
Image image1 = Image.getInstance(stream1.toByteArray());
PdfPCell cell3 = new PdfPCell(image1, false);
cell3.setPadding(30);
cell3.setBorderWidth(0.0f);
image1.scaleToFit(100, 500);
image1.setAlignment(image1.ALIGN_RIGHT);
table5.addCell(cell3);
document.add(table5);
document.close();
を使用して、私の画像を追加しています。代わりに、前のテキストを上書きします。誰か助けてください。
この回答は機能しています。コンテンツの最後に画像を追加する方法を提案できますか? –