If you need to copy a PDF with annotations to a new PDF without annotations, 
you can use PdfWriter to create a new pdf with all pages imported from the 
source pdf. PdfImportedPage with PdfWriter does not preserve annotations.
Something similar to:

Document document = new Document(PageSize.A4);
PdfWriter writer = PdfWriter.getInstance(document, new 
FileOutputStream("output.pdf"));
PdfReader reader = new PdfReader("source.pdf");
document.open();
PdfContentByte canvas = writer.getDirectContent();
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
    canvas.addTemplate(writer.getImportedPage(reader, i), 0, 0);
    document.newPage();
}
document.close();

you should also consider source page size and rotation.

Fabrizio




________________________________
Da: Cameron Laird <claird.visipr...@gmail.com>
A: itext-questions@lists.sourceforge.net
Inviato: Dom 29 novembre 2009, 23:06:51
Oggetto: [iText-questions] What's the opposite of "annotate or comment"?

How do I "flatten" comments and annotations? 

I doubt that my question has much to do with iText; however, after looking 
through The Book and The Standard, I still don't even know how to phrase my 
question well, so I ask the indulgence of the list:  please help me figure out 
at least the right keywords to use in investigating this matter.

Quite a few applications decorate a PDF instance with "annotations", 
"comments", "sticky notes", ...  How can I "flatten" (I recognize that's a 
misnomer, with a specific meaning related to FDFs) an annotated PDF into an 
"integral" PDF with the same appearance?  The Preview application supplied with 
Mac OS does what I want:  "print as PDF" produces just the "flattened" form I 
want, in which the comments are visible, but appear as part of the document, 
and are no longer comments.  While I suspect that iText or perhaps other 
libraries give me programmatic access to the same operation, I haven't figured 
out what it's called well enough to identify it in The Book or elsewhere.


      
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to