public static void main(String[] args) { // open input PDF PdfContentEditor pdfContentEditor = new PdfContentEditor(); pdfContentEditor.bindPdf("Input.pdf"); // replace text on all pages pdfContentEditor.replaceText("Hello", "World"); // save output PDF pdfContentEditor.save("ReplaceTextOnAllPages.pdf"); }
public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(ReplaceImage.class); // open input PDF PdfContentEditor pdfContentEditor = new PdfContentEditor(); pdfContentEditor.bindPdf(dataDir + "Input.pdf"); // replace image on a particular page pdfContentEditor.replaceImage(1, 1, dataDir + "image2.bmp"); // save output PDF pdfContentEditor.save(dataDir + "Output.pdf"); }
public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = "src/programmersguide/workingwithasposepdffacades/workingwithtext/replacetextonparticularpage/data/"; // open input PDF com.aspose.pdf.facades.PdfContentEditor pdfContentEditor = new com.aspose.pdf.facades.PdfContentEditor(); pdfContentEditor.bindPdf(dataDir + "Input.pdf"); // replace text on a particular page pdfContentEditor.replaceText("Content", 2, "World"); // save output PDF pdfContentEditor.save(dataDir + "ReplaceTextOnAllPages.pdf"); }