此代码已构建并且运行良好,运行一段时间后出现了错误
public class Ax {
public static void main(String[] args) {
try {
PdfReader pdfReader = new PdfReader("E:\\HelloWorld.pdf");
PdfStamper pdfStamper = new PdfStamper(pdfReader,
new FileOutputStream("E:\\HelloWorld-Stamped.pdf"));
Image image = Image.getInstance("C:\\Users\\Oliver\\Desktop\\user_access-512.png");
for(int i=1; i<= pdfReader.getNumberOfPages(); i++){
PdfContentByte content = pdfStamper.getUnderContent(i);
image.setAbsolutePosition(10f, 70f);
content.addImage(image);
}
pdfStamper.close();
} catch (IOException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}
}
}
我使用了 itextpdf-5.4.1.jar 库
我应如何解决此问题?