|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.itextpdf.text.pdf.ocg.OCGParser
public class OCGParser
A helper class for OCGRemover.
Nested Class Summary | |
---|---|
static interface |
OCGParser.PdfOperator
PDF Operator interface. |
Field Summary | |
---|---|
protected static ByteArrayOutputStream |
baos
The OutputStream of this worker object. |
static String |
DEFAULTOPERATOR
Constant used for the default operator. |
protected int |
mc_balance
Keeps track of BMC/EMC balance. |
protected Set<String> |
ocgs
The OCGs that need to be removed. |
protected static Map<String,OCGParser.PdfOperator> |
operators
A map with all supported operators operators (PDF syntax). |
protected com.itextpdf.text.pdf.PdfDictionary |
properties
The OCG properties. |
protected Set<com.itextpdf.text.pdf.PdfName> |
xobj
The names of XObjects that shouldn't be shown. |
Constructor Summary | |
---|---|
OCGParser(Set<String> ocgs)
Creates an instance of the OCGParser. |
Method Summary | |
---|---|
protected void |
checkMarkedContentEnd()
Keeps track of the MarkedContent state. |
protected void |
checkMarkedContentStart(com.itextpdf.text.pdf.PdfName ocref)
Keeps track of the MarkedContent state. |
protected boolean |
isToRemoved()
Checks if the parser is currently parsing content that needs to be ignored. |
protected boolean |
isVisible(List<com.itextpdf.text.pdf.PdfObject> operands)
Checks operands to find out if the corresponding operator needs to be present or not. |
void |
parse(com.itextpdf.text.pdf.PRStream stream,
com.itextpdf.text.pdf.PdfDictionary resources)
Parses a stream object and removes OCGs. |
protected void |
populateOperators()
Populates the operators variable. |
protected void |
println(com.itextpdf.text.pdf.PdfObject o)
Writes a PDF object to the OutputStream, followed by a newline character. |
protected void |
printsp(com.itextpdf.text.pdf.PdfObject o)
Writes a PDF object to the OutputStream, followed by a space character. |
protected void |
process(com.itextpdf.text.pdf.PdfLiteral operator,
List<com.itextpdf.text.pdf.PdfObject> operands,
boolean removable)
Processes an operator |
protected static void |
processOperator(OCGParser parser,
com.itextpdf.text.pdf.PdfLiteral operator,
List<com.itextpdf.text.pdf.PdfObject> operands)
Processes an operator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULTOPERATOR
protected static Map<String,OCGParser.PdfOperator> operators
protected static ByteArrayOutputStream baos
protected int mc_balance
protected Set<com.itextpdf.text.pdf.PdfName> xobj
protected Set<String> ocgs
protected com.itextpdf.text.pdf.PdfDictionary properties
Constructor Detail |
---|
public OCGParser(Set<String> ocgs)
ocgs
- a set of String values with the names of the OCGs that need to be removed.Method Detail |
---|
public void parse(com.itextpdf.text.pdf.PRStream stream, com.itextpdf.text.pdf.PdfDictionary resources) throws IOException
stream
- a stream objectresources
- the resources dictionary of that object (containing info about the OCGs)
IOException
protected static void processOperator(OCGParser parser, com.itextpdf.text.pdf.PdfLiteral operator, List<com.itextpdf.text.pdf.PdfObject> operands) throws Exception
parser
- the parser that needs to process the operatoroperator
- the operatoroperands
- its operands
Exception
protected void populateOperators()
protected boolean isVisible(List<com.itextpdf.text.pdf.PdfObject> operands)
operands
- a list of operands
protected boolean isToRemoved()
protected void checkMarkedContentStart(com.itextpdf.text.pdf.PdfName ocref)
ocref
- a reference to an OCG dictionaryprotected void checkMarkedContentEnd()
protected void process(com.itextpdf.text.pdf.PdfLiteral operator, List<com.itextpdf.text.pdf.PdfObject> operands, boolean removable) throws IOException
operator
- the operatoroperands
- its operandsremovable
- is the operator eligable for removal?
IOException
protected void printsp(com.itextpdf.text.pdf.PdfObject o) throws IOException
o
-
IOException
protected void println(com.itextpdf.text.pdf.PdfObject o) throws IOException
o
-
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |