我正在使用Apache PDFBox将转换图像(png,jpg)转换为pdf,问题是以下操作后文档页面是空白的:
PDDocument doc = new PDDocument();
for (BufferedImage buff : list) {
PDPage page = new PDPage(new PDRectangle(buff.getWidth(), buff.getHeight()));
doc.addPage(page);
PDXObjectImage ximage = new PDJpeg(doc, buff);
PDPageContentStream content = new PDPageContentStream(doc, page);
content.drawImage(ximage, 0, 0);
content.close();
}
doc.save(outStream);
doc.close();
有人可以帮忙吗? 提前谢谢。