Package com.itextpdf.text.pdf.ocg
Class OCGRemover
- java.lang.Object
-
- com.itextpdf.text.pdf.ocg.OCGRemover
-
public class OCGRemover extends java.lang.ObjectClass that knows how to remove OCG layers.
-
-
Constructor Summary
Constructors Constructor Description OCGRemover()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanisToBeRemoved(PdfDictionary ocg, java.util.Set<java.lang.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, java.util.Set<java.lang.String> ocgs)Removes annotations from a page dictionaryvoidremoveLayers(PdfReader reader, java.lang.String... layers)Removes layers from a PDF documentprivate voidremoveOCGsFromArray(PdfArray array, java.util.Set<java.lang.String> ocgs)Searches an array for references to OCGs that need to be removed.private voidremoveOCGsFromArray(PdfDictionary dict, PdfName name, java.util.Set<java.lang.String> ocgs)Gets an array from a dictionary and checks if it contains references to OCGs that need to be removedprivate voidremoveProperties(PdfDictionary page, java.util.Set<java.lang.String> ocgs)Removes ocgs from a page resources
-
-
-
Method Detail
-
removeLayers
public void removeLayers(PdfReader reader, java.lang.String... layers) throws java.io.IOException
Removes layers from a PDF document- Parameters:
reader- a PdfReader containing a PDF documentlayers- a sequence of names of OCG layers- Throws:
java.io.IOException
-
removeOCGsFromArray
private void removeOCGsFromArray(PdfDictionary dict, PdfName name, java.util.Set<java.lang.String> ocgs)
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
private void removeOCGsFromArray(PdfArray array, java.util.Set<java.lang.String> ocgs)
Searches an array for references to OCGs that need to be removed.- Parameters:
array- the arrayocgs- the removal list
-
removeAnnots
private void removeAnnots(PdfDictionary page, java.util.Set<java.lang.String> ocgs)
Removes annotations from a page dictionary- Parameters:
page- a page dictionaryocgs- a set of names of OCG layers
-
removeProperties
private void removeProperties(PdfDictionary page, java.util.Set<java.lang.String> ocgs)
Removes ocgs from a page resources- Parameters:
page- a page dictionaryocgs- a set of names of OCG layers
-
isToBeRemoved
private boolean isToBeRemoved(PdfDictionary ocg, java.util.Set<java.lang.String> names)
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
private void parse(OCGParser parser, PdfDictionary page) throws java.io.IOException
Uses the OCGParser on a page- Parameters:
parser- the OCGParserpage- the page dictionary of the page that needs to be parsed.- Throws:
java.io.IOException
-
-