Class PdfWriterPipeline
- java.lang.Object
-
- com.itextpdf.tool.xml.pipeline.AbstractPipeline<MapContext>
-
- com.itextpdf.tool.xml.pipeline.end.PdfWriterPipeline
-
- All Implemented Interfaces:
Pipeline<MapContext>
public class PdfWriterPipeline extends AbstractPipeline<MapContext>
This pipeline writes to a Document.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Boolean
continiously
static java.lang.String
CONTINUOUS
The key for the a boolean in theMapContext
used asCustomContext
.private Document
doc
static java.lang.String
DOCUMENT
private static Logger
LOG
private PdfWriter
writer
static java.lang.String
WRITER
-
Constructor Summary
Constructors Constructor Description PdfWriterPipeline()
PdfWriterPipeline(Document doc, PdfWriter writer)
PdfWriterPipeline(Pipeline<?> next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pipeline<?>
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, java.lang.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
setWriter(PdfWriter writer)
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 Detail
-
LOG
private static final Logger LOG
-
doc
private Document doc
-
writer
private PdfWriter writer
-
DOCUMENT
public static final java.lang.String DOCUMENT
- See Also:
- Constant Field Values
-
WRITER
public static final java.lang.String WRITER
- See Also:
- Constant Field Values
-
CONTINUOUS
public static final java.lang.String CONTINUOUS
The key for the a boolean in theMapContext
used asCustomContext
. Setting to true enables swallowing of DocumentExceptions- See Also:
- Constant Field Values
-
continiously
private java.lang.Boolean continiously
-
-
Method Detail
-
init
public Pipeline<?> init(WorkerContext context) throws PipelineException
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
private void write(WorkerContext context, ProcessObject po) throws PipelineException
- Parameters:
po
-- Throws:
PipelineException
-
open
public Pipeline<?> open(WorkerContext context, Tag t, ProcessObject po) throws PipelineException
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, java.lang.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
public Pipeline<?> close(WorkerContext context, Tag t, ProcessObject po) throws PipelineException
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
public void setDocument(Document document)
The document to write to.- Parameters:
document
- the Document
-
setWriter
public void setWriter(PdfWriter writer)
The writer used to write to the document.- Parameters:
writer
- the writer.
-
-