Java 在google app engine上使用pdfbox将图像添加到pdf

Java 在google app engine上使用pdfbox将图像添加到pdf,java,google-app-engine,pdf,pdfbox,Java,Google App Engine,Pdf,Pdfbox,我在谷歌应用程序引擎上使用pdxbox,我使用修改后的版本与应用程序引擎兼容 但我无法在pdf中添加图像。因为:javax.imageio.imageio是一个受限类 我需要使这项工作: BufferedImage awtImage = ImageIO.read(new File(image)); 我发现了两个链接可以帮助我,但我不知道如何使用它: ->导入到我的项目中,但com.google.code.appengine.awt.image.buffereImage不能用于pdfbox的

我在谷歌应用程序引擎上使用pdxbox,我使用修改后的版本与应用程序引擎兼容

但我无法在pdf中添加图像。因为:javax.imageio.imageio是一个受限类

我需要使这项工作:

BufferedImage awtImage = ImageIO.read(new File(image));
我发现了两个链接可以帮助我,但我不知道如何使用它:

->导入到我的项目中,但com.google.code.appengine.awt.image.buffereImage不能用于pdfbox的方法

编辑:

PDDocument document = new PDDocument();

PDPage tmp = (PDPage) PDDocument.load("WEB-INF/pdfs/TemplateFactureEmpty3.pdf").getDocumentCatalog().getAllPages().get(0);
document.addPage(tmp);
PDPageContentStream content = new PDPageContentStream(document, tmp, true, true);

// choice 1 , pb : call ImageIO restricted
InputStream in = new FileInputStream(new File("WEB-INF/CokeLogo1.png"));
PDJpeg ximage = new PDJpeg(document, in);

// choise 2 , pb : BufferedImage and ImageIO restricted
BufferedImage awtImage = ImageIO.read(new File("WEB-INF/CokeLogo1.png") );
PDXObjectImage ximage = new PDPixelMap(document, awtImage);

float scale = 1f; // alter this value to set the image size
content.drawXObject(ximage, 56, 800, ximage.getWidth() * scale,ximage.getHeight() * scale);
谢谢,
Francois

请发布使用pdfbox.Done创建pdf的全部代码,但问题不在于libit,而在于lib-好吧,您所指的pdfbox版本已经创建,GAE可以正常运行以进行简单的文本提取。你的任务完全不同。因此,你显然需要再修补一些PDFBox。嗨@Kingstone59,你能解决它吗?同样的问题