我已经在线尝试了许多示例代码,但是我不知道如何将图像实现为Itext
PDF文件。有人可以帮我吗?
谢谢。
答案 0 :(得分:0)
// This is written based on ItextPdf java
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream("sample1.pdf"));
document.open();
Image img = Image.getInstance("arvind-rai.png");
document.add(new Paragraph("Sample 1: This is simple image demo."));
document.add(img);
document.close();
// Follow below link if you want solution in android
https://stackoverflow.com/a/15742238/5380981
答案 1 :(得分:0)
这是检查结帐的解决方案,
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream("sample2.pdf"));
document.open();
Image img = Image.getInstance("arvind-rai.png");
img.setAbsolutePosition(450f, 10f);
document.add(img);
document.close();