現在、PDF からページを取得し、その特定のページを編集しようとしています。編集を行うと、PDF自体に保存されません。
これは私のコードで、誰かが助けてくれます。
PDPage page = (PDPage) allPages.get(f);
System.out.println(page);
PDRectangle pageSize = page.findMediaBox();
float stringWidth = font.getStringWidth( "AAA" );
float centeredPosition = (pageSize.getWidth() - (stringWidth*fontSize)/1000f)/2f;
PDPageContentStream contentStream = new PDPageContentStream(pdoc,page,true,false);
contentStream.beginText();
contentStream.setFont( font, fontSize );
//contentStream.addLine(700, 700, 700, 1000);
contentStream.moveTextPositionByAmount(0 , 0);
contentStream.drawString( "AAA" );
contentStream.endText();
contentStream.close();
pdoc.save("C:/1/1.pdf");
pdoc.close();