I wonder if that text wasn't hidden with an annotation. Paulo
----- Original Message ----- From: "parvez ahmed" <[EMAIL PROTECTED]> To: "Post all your questions about iText here" <[email protected]> Sent: Friday, June 22, 2007 6:53 PM Subject: Re: [iText-questions] removing Hidden content in PDF I have used PDFCopy and hidden text is hidden. Whereas,its not true with PDFWriter. As you mentioned, I will try parsing content stream. Thanks Leonard Rosenthol <[EMAIL PROTECTED]> wrote: PDFCopy WILL copy hidden text - it copies everything... Your method will copying everything AND any hidden text will stay hidden. Are you saying that it does not?? The only way to remove hidden text would be for you to parse the content stream (PdfContentByte) yourself and manipulate it to remove the things you don't want. NOT trivial - but well defined. Leonard On Jun 22, 2007, at 12:27 PM, parvez ahmed wrote: > I have PDF with hidden text in existing.pdf . While copying > pdf , I am able to view the hidden text in output pdf. Is there any > class or method to remove hiddent text from pdf ? > > Below is the code. I know, PDFCopy will not copy hidden text to > output.pdf. I dont want to use PDFCopy tough. > > String existingPdf = "existing.pdf"; > try { > PdfReader reader = new PdfReader(existingPdf); > File outFile = new File("output.pdf"); > Document document = new Document(reader.getPageSizeWithRotation > (1)); > PdfWriter writer = PdfWriter.getInstance(document, new > FileOutputStream(outFile)); > document.open(); > PdfContentByte cb = writer.getDirectContent(); > for (int i = 1; i <= reader.getNumberOfPages(); i++) { > document.newPage(); > System.out.println(i); > PdfImportedPage page = writer.getImportedPage(reader, i); > cb.addTemplate(page, 0, 0); > } > document.close(); > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
