Q:
We need a server based JAVA tool/SDK that can flatten Cross Out Tool
Annotations as well as Pencil Tool Annotations (terms used in
Acrobat). Can we use PDFNet SDK to flatten both of these Annotation
types?
---------------
A: You can use PDFNet SDK to flatten Cross-Out, Pencil, as well as any
other annotation type.
As a starting point you may want to download the SDK for your platform
(http://www.pdftron.com/pdfnet/downloads.html) and take a look at
Annotation sample project: http://www.pdftron.com/pdfnet/samplecode.html#Annotation
The code would look along the following lines (in Java, but other
languages are similar):
PDFDoc doc=new PDFDoc("my.pdf"));
doc.initSecurityHandler();
for (PageIterator pitr = doc.getPageIterator(); pitr.hasNext(); ) {
Page page = (Page)(pitr.next());
// Flatten the annotations on the page.
// Note: The annotations must be flattened/erased in the reverse
order.
int num = page.getNumAnnots();
for (int i = num-1; i>=0; --i) {
Annot ann = page.getAnnot(i);
Annot.Type t = ann.getType();
// if (t== Annot. e_StrikeOut || t== Annot.e_Polyline) {
// Generate the appearance (if it is missing)?:
ann.refreshAppearance();
ann.flatten(page);
// }
}
doc.Save(...);
doc.Close();