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();
   
   
  Thanks,
  Peter

       
---------------------------------
Luggage? GPS? Comic books? 
Check out fitting  gifts for grads at Yahoo! Search.
-------------------------------------------------------------------------
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/

Reply via email to