Class PdfWriter
public class PdfWriter : PdfOutputStream, IDisposable, IAsyncDisposable
- Inheritance
-
PdfWriter
- Implements
- Inherited Members
Constructors
PdfWriter(FileInfo)
Create a PdfWriter writing to the passed File and with default writer properties.
public PdfWriter(FileInfo file)
Parameters
file
FileInfoFile to write to.
PdfWriter(Stream)
Create a PdfWriter writing to the passed outputstream and with default writer properties.
public PdfWriter(Stream os)
Parameters
os
StreamOutputstream to write to.
PdfWriter(Stream, WriterProperties)
public PdfWriter(Stream os, WriterProperties properties)
Parameters
os
Streamproperties
WriterProperties
PdfWriter(string)
Create a PdfWriter writing to the passed filename and with default writer properties.
public PdfWriter(string filename)
Parameters
filename
stringfilename of the resulting pdf.
PdfWriter(string, WriterProperties)
Create a PdfWriter writing to the passed filename and using the passed writer properties.
public PdfWriter(string filename, WriterProperties properties)
Parameters
filename
stringfilename of the resulting pdf.
properties
WriterPropertieswriterproperties to use.
Fields
isUserWarnedAboutAcroFormCopying
protected bool isUserWarnedAboutAcroFormCopying
Field Value
properties
protected WriterProperties properties
Field Value
Methods
CopyObject(PdfObject, PdfDocument, bool)
Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo.
protected virtual PdfObject CopyObject(PdfObject obj, PdfDocument documentTo, bool allowDuplicating)
Parameters
obj
PdfObjectobject to copy
documentTo
PdfDocumentoptional target document
allowDuplicating
boolallow that some objects will become duplicated by this action
Returns
- PdfObject
the copies object
CopyObject(PdfObject, PdfDocument, bool, ICopyFilter)
Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo.
protected virtual PdfObject CopyObject(PdfObject obj, PdfDocument documentTo, bool allowDuplicating, ICopyFilter copyFilter)
Parameters
obj
PdfObjectobject to copy
documentTo
PdfDocumentoptional target document
allowDuplicating
boolallow that some objects will become duplicated by this action
copyFilter
ICopyFilterICopyFilter a filter to apply while copying arrays and dictionaries
-
Use
NullCopyFilter for no filtering
-
Returns
- PdfObject
the copies object
FlushModifiedWaitingObjects(ICollection<PdfIndirectReference>)
Flushes all modified objects which have not been flushed yet.
protected virtual void FlushModifiedWaitingObjects(ICollection<PdfIndirectReference> forbiddenToFlush)
Parameters
forbiddenToFlush
ICollection<PdfIndirectReference>a
of references that are forbidden to be flushed automatically.
Remarks
Flushes all modified objects which have not been flushed yet. Used in case incremental updates.
FlushObject(PdfObject, bool)
Flushes the object.
protected virtual void FlushObject(PdfObject pdfObject, bool canBeInObjStm)
Parameters
pdfObject
PdfObjectobject to flush.
canBeInObjStm
boolindicates whether object can be placed into object stream.
Remarks
Flushes the object. Override this method if you want to define custom behaviour for object flushing.
FlushWaitingObjects(ICollection<PdfIndirectReference>)
Flushes all objects which have not been flushed yet.
protected virtual void FlushWaitingObjects(ICollection<PdfIndirectReference> forbiddenToFlush)
Parameters
forbiddenToFlush
ICollection<PdfIndirectReference>a
of references that are forbidden to be flushed automatically.
GetCompressionLevel()
Gets default compression level for @see PdfStream.
public virtual int GetCompressionLevel()
Returns
- int
compression level.
Remarks
Gets default compression level for @see PdfStream. For more details @see DeflaterOutputStream.
GetProperties()
Gets the writer properties.
public virtual WriterProperties GetProperties()
Returns
- WriterProperties
The WriterProperties of the current PdfWriter.
InitCryptoIfSpecified(PdfVersion)
protected virtual void InitCryptoIfSpecified(PdfVersion version)
Parameters
version
PdfVersion
IsFullCompression()
Indicates if to use full compression mode.
public virtual bool IsFullCompression()
Returns
- bool
true if to use full compression, false otherwise.
SetCompressionLevel(int)
Sets default compression level for @see PdfStream.
public virtual PdfWriter SetCompressionLevel(int compressionLevel)
Parameters
compressionLevel
intcompression level.
Returns
Remarks
Sets default compression level for @see PdfStream. For more details @see DeflaterOutputStream.
SetSmartMode(bool)
Sets the smart mode.
public virtual PdfWriter SetSmartMode(bool smartMode)
Parameters
smartMode
boolTrue for enabling smart mode.
Returns
Remarks
Sets the smart mode.
In smart mode when resources (such as fonts, images,...) are
encountered, a reference to these resources is saved
in a cache, so that they can be reused.
This requires more memory, but reduces the file size
of the resulting PDF document.
WriteHeader()
Writes PDF header.
protected virtual void WriteHeader()
WriteToBody(PdfObject)
Writes object to body of PDF document.
protected virtual void WriteToBody(PdfObject pdfObj)
Parameters
pdfObj
PdfObjectobject to write.