Class PdfWriterPipeline
java.lang.Object
com.itextpdf.tool.xml.pipeline.AbstractPipeline<MapContext>
com.itextpdf.tool.xml.pipeline.end.PdfWriterPipeline
- All Implemented Interfaces:
Pipeline<MapContext>
This pipeline writes to a Document.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Boolean
static final String
The key for the a boolean in theMapContext
used asCustomContext
.private Document
static final String
private static final Logger
private PdfWriter
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionPdfWriterPipeline
(Document doc, PdfWriter writer) PdfWriterPipeline
(Pipeline<?> next) -
Method Summary
Modifier and TypeMethodDescriptionPipeline
<?> close
(WorkerContext context, Tag t, ProcessObject po) Just calls getNext.
Override this to get notified on encountered closing tags.Pipeline
<?> content
(WorkerContext context, Tag currentTag, String text, ProcessObject po) Just calls getNext.
Override this to get notified on encountered content.Pipeline
<?> init
(WorkerContext context) The init method allows implementation to initialize the pipeline.Pipeline
<?> open
(WorkerContext context, Tag t, ProcessObject po) Just calls getNext.
Override this to get notified on encountered opening tags.void
setDocument
(Document document) The document to write to.void
The writer used to write to the document.private void
write
(WorkerContext context, ProcessObject po) Methods inherited from class com.itextpdf.tool.xml.pipeline.AbstractPipeline
getContextKey, getLocalContext, getNext, setNext
-
Field Details
-
LOG
-
doc
-
writer
-
DOCUMENT
- See Also:
-
WRITER
- See Also:
-
CONTINUOUS
The key for the a boolean in theMapContext
used asCustomContext
. Setting to true enables swallowing of DocumentExceptions- See Also:
-
continiously
-
-
Constructor Details
-
PdfWriterPipeline
public PdfWriterPipeline() -
PdfWriterPipeline
- Parameters:
next
- the next pipeline if any.
-
PdfWriterPipeline
- Parameters:
doc
- the documentwriter
- the writer
-
-
Method Details
-
init
Description copied from interface:Pipeline
The init method allows implementation to initialize the pipeline. e.g. Initialize their CustomContext here and add it to the WorkerContext throughWorkerContext.put(String, CustomContext)
.- Specified by:
init
in interfacePipeline<MapContext>
- Overrides:
init
in classAbstractPipeline<MapContext>
- Parameters:
context
- the WorkerContext- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-
write
- Parameters:
po
-- Throws:
PipelineException
-
open
Description copied from class:AbstractPipeline
Just calls getNext.
Override this to get notified on encountered opening tags.- Specified by:
open
in interfacePipeline<MapContext>
- Overrides:
open
in classAbstractPipeline<MapContext>
- Parameters:
context
- the WorkerContextt
- the Tagpo
- a processObject to putWritable
s in- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-
content
public Pipeline<?> content(WorkerContext context, Tag currentTag, String text, ProcessObject po) throws PipelineException Description copied from class:AbstractPipeline
Just calls getNext.
Override this to get notified on encountered content.- Specified by:
content
in interfacePipeline<MapContext>
- Overrides:
content
in classAbstractPipeline<MapContext>
- Parameters:
context
- the WorkerContextcurrentTag
- the Tagtext
- the contentpo
- a processObject to putWritable
s in- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-
close
Description copied from class:AbstractPipeline
Just calls getNext.
Override this to get notified on encountered closing tags.- Specified by:
close
in interfacePipeline<MapContext>
- Overrides:
close
in classAbstractPipeline<MapContext>
- Parameters:
context
- the WorkerContextt
- the Tagpo
- a processObject to putWritable
s in- Returns:
- the next pipeline in line
- Throws:
PipelineException
- can be thrown to indicate that something went wrong.
-
setDocument
The document to write to.- Parameters:
document
- the Document
-
setWriter
The writer used to write to the document.- Parameters:
writer
- the writer.
-