Edit PDF in Java
High-speed and cross-platform Java library for editing PDF using Java code
Edit PDF using Aspose.Slides
Aspose.Slides for Java is a powerful Java library used to manipulate and edit presentations, PDF documents, and other files. You can edit an PDF doc by adding a new line of text to it.
Edit PDF in Java
Using Aspose.Slides for Java , you can add a new line of text to an PDF document with just a few lines of code.
Java code for editing PDF
Presentation pres = new Presentation();
try {
pres.getSlides().removeAt(0);
pres.getSlides().addFromPdf("document.pdf");
ISlide slide = pres.getSlides().get_Item(0);
IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 10, 10, 100, 50);
shape.getTextFrame().setText("New text");
pres.save("document.pdf", SaveFormat.Pdf);
} finally {
if (pres != null) pres.dispose();
}
How to edit PDF in Java
Install Aspose.Slides for Java. See Installation .
Add the library as a reference in your project.
Create an instance of the Presentation class.
Load the PDF document you want to edit.
Add a new line of text.
Save the changed PDF file.