public class OCGParser extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
OCGParser.PdfOperator
PDF Operator interface.
|
Modifier and Type | Field and Description |
---|---|
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 PdfDictionary |
properties
The OCG properties.
|
protected Set<PdfName> |
xobj
The names of XObjects that shouldn't be shown.
|
Constructor and Description |
---|
OCGParser(Set<String> ocgs)
Creates an instance of the OCGParser.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkMarkedContentEnd()
Keeps track of the MarkedContent state.
|
protected void |
checkMarkedContentStart(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<PdfObject> operands)
Checks operands to find out if the corresponding operator needs to be present or not.
|
void |
parse(PRStream stream, PdfDictionary resources)
Parses a stream object and removes OCGs.
|
protected void |
populateOperators()
Populates the operators variable.
|
protected void |
println(PdfObject o)
Writes a PDF object to the OutputStream, followed by a newline character.
|
protected void |
printsp(PdfObject o)
Writes a PDF object to the OutputStream, followed by a space character.
|
protected void |
process(PdfLiteral operator, List<PdfObject> operands, boolean removable)
Processes an operator
|
protected static void |
processOperator(OCGParser parser, PdfLiteral operator, List<PdfObject> operands)
Processes an operator.
|
public static final String DEFAULTOPERATOR
protected static Map<String,OCGParser.PdfOperator> operators
protected static ByteArrayOutputStream baos
protected int mc_balance
protected PdfDictionary properties
public void parse(PRStream stream, PdfDictionary resources) throws IOException
stream
- a stream object
resources
- the resources dictionary of that object (containing info about the OCGs)
IOException
protected static void processOperator(OCGParser parser, PdfLiteral operator, List<PdfObject> operands) throws Exception
parser
- the parser that needs to process the operator
operator
- the operator
operands
- its operands
Exception
protected void populateOperators()
protected boolean isVisible(List<PdfObject> operands)
operands
- a list of operands
protected boolean isToRemoved()
protected void checkMarkedContentStart(PdfName ocref)
ocref
- a reference to an OCG dictionary
protected void checkMarkedContentEnd()
protected void process(PdfLiteral operator, List<PdfObject> operands, boolean removable) throws IOException
operator
- the operator
operands
- its operands
removable
- is the operator eligable for removal?
IOException
protected void printsp(PdfObject o) throws IOException
o
-
IOException
protected void println(PdfObject o) throws IOException
o
-
IOException
Copyright © 2016. All rights reserved.