Package com.itextpdf.text.pdf.ocg
Class OCGRemover
java.lang.Object
com.itextpdf.text.pdf.ocg.OCGRemover
Class that knows how to remove OCG layers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanisToBeRemoved(PdfDictionary ocg, Set<String> names) Checks if an OCG dictionary is on the list for removal.private voidparse(OCGParser parser, PdfDictionary page) Uses the OCGParser on a pageprivate voidremoveAnnots(PdfDictionary page, Set<String> ocgs) Removes annotations from a page dictionaryvoidremoveLayers(PdfReader reader, String... layers) Removes layers from a PDF documentprivate voidremoveOCGsFromArray(PdfArray array, Set<String> ocgs) Searches an array for references to OCGs that need to be removed.private voidremoveOCGsFromArray(PdfDictionary dict, PdfName name, Set<String> ocgs) Gets an array from a dictionary and checks if it contains references to OCGs that need to be removedprivate voidremoveProperties(PdfDictionary page, Set<String> ocgs) Removes ocgs from a page resources
-
Constructor Details
-
OCGRemover
public OCGRemover()
-
-
Method Details
-
removeLayers
Removes layers from a PDF document- Parameters:
reader- a PdfReader containing a PDF documentlayers- a sequence of names of OCG layers- Throws:
IOException
-
removeOCGsFromArray
Gets an array from a dictionary and checks if it contains references to OCGs that need to be removed- Parameters:
dict- the dictionaryname- the name of an array entryocgs- the removal list
-
removeOCGsFromArray
Searches an array for references to OCGs that need to be removed.- Parameters:
array- the arrayocgs- the removal list
-
removeAnnots
Removes annotations from a page dictionary- Parameters:
page- a page dictionaryocgs- a set of names of OCG layers
-
removeProperties
Removes ocgs from a page resources- Parameters:
page- a page dictionaryocgs- a set of names of OCG layers
-
isToBeRemoved
Checks if an OCG dictionary is on the list for removal.- Parameters:
ocg- a dictionarynames- the removal list- Returns:
- true if the dictionary should be removed
-
parse
Uses the OCGParser on a page- Parameters:
parser- the OCGParserpage- the page dictionary of the page that needs to be parsed.- Throws:
IOException
-