How do I modify this method to write the contents of the modified document to a file name pdfOutput. My aim is to get a document showing the modified changes so I can test the output:
public static void addPageFooter(ByteArrayOutputStream baos) throws Exception { PdfReader reader = new PdfReader(baos.toByteArray()); PdfStamper stamper = new PdfStamper(reader, baos); int numOfPages = reader.getNumberOfPages(); for (int i=1; i<=numOfPages; i++) ColumnText.showTextAligned( stamper.getUnderContent(i), PdfContentByte.ALIGN_CENTER, new Phrase("Page "+i), reader.getPageSize(i).getWidth()/2, 5, 0); stamper.close(); reader.close(); }