iText 9.0.0 API
iText.Kernel.Pdf.PdfWriter Class Reference
Inheritance diagram for iText.Kernel.Pdf.PdfWriter:
iText.Kernel.Pdf.PdfOutputStream iText.IO.Source.HighPrecisionOutputStream< iText.Kernel.Pdf.PdfOutputStream >

Public Member Functions

  PdfWriter (FileInfo file)
  Create a PdfWriter writing to the passed File and with default writer properties. More...
 
  PdfWriter (Stream os)
  Create a PdfWriter writing to the passed outputstream and with default writer properties. More...
 
  PdfWriter (Stream os, WriterProperties properties)
  Creates PdfWriter instance, which writes to the passed System.IO.Stream , using provided WriterProperties. More...
 
  PdfWriter (String filename)
  Create a PdfWriter writing to the passed filename and with default writer properties. More...
 
  PdfWriter (String filename, WriterProperties properties)
  Create a PdfWriter writing to the passed filename and using the passed writer properties. More...
 
virtual bool  IsFullCompression ()
  Indicates if to use full compression mode. More...
 
virtual int  GetCompressionLevel ()
  Gets default compression level for More...
 
virtual iText.Kernel.Pdf.PdfWriter  SetCompressionLevel (int compressionLevel)
  Sets default compression level for More...
 
virtual PdfVersion  GetPdfVersion ()
  Gets defined pdf version for the document. More...
 
virtual WriterProperties  GetProperties ()
  Gets the writer properties. More...
 
virtual iText.Kernel.Pdf.PdfWriter  SetSmartMode (bool smartMode)
  Sets the smart mode. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfOutputStream
  PdfOutputStream (Stream outputStream)
  Create a pdfOutputSteam writing to the passed OutputStream. More...
 
virtual iText.Kernel.Pdf.PdfOutputStream  Write (PdfObject pdfObject)
  Write a PdfObject to the outputstream. More...
 
- Public Member Functions inherited from iText.IO.Source.HighPrecisionOutputStream< iText.Kernel.Pdf.PdfOutputStream >
bool?  GetLocalHighPrecision ()
 
void  SetLocalHighPrecision (bool value)
 
  HighPrecisionOutputStream (Stream outputStream)
 
  HighPrecisionOutputStream (Stream outputStream, bool localHighPrecision)
 
virtual void  Write (int b)
 
virtual void  Write (byte[] b)
 
override void  Write (byte[] b, int off, int len)
 
override long  Seek (long offset, SeekOrigin origin)
 
override void  SetLength (long value)
 
override int  Read (byte[] buffer, int offset, int count)
 
override void  WriteByte (byte value)
 
virtual T  WriteByte (int value)
 
override void  Flush ()
 
virtual T  WriteLong (long value)
 
virtual T  WriteInteger (int value)
 
virtual T  WriteFloat (float value)
 
virtual T  WriteFloat (float value, bool highPrecision)
 
virtual T  WriteFloats (float[] value)
 
virtual T  WriteDouble (double value)
 
virtual T  WriteDouble (double value, bool highPrecision)
 
virtual T  WriteSpace ()
 
virtual T  WriteNewLine ()
 
virtual T  WriteString (String value)
 
virtual T  WriteBytes (byte[] b)
 
virtual T  WriteBytes (byte[] b, int off, int len)
 
virtual long  GetCurrentPos ()
 
virtual Stream  GetOutputStream ()
 
virtual bool  IsCloseStream ()
 
virtual void  SetCloseStream (bool closeStream)
 
virtual void  AssignBytes (byte[] bytes, int count)
 
virtual void  Reset ()
 

Package Functions

virtual void  InitCryptoIfSpecified (PdfVersion version)
  Initializes PdfEncryption object if any encryption is specified in WriterProperties. More...
 
virtual void  FlushObject (PdfObject pdfObject, bool canBeInObjStm)
  Flushes the object. More...
 
virtual PdfObject  CopyObject (PdfObject obj, PdfDocument documentTo, bool allowDuplicating)
  Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo. More...
 
virtual PdfObject  CopyObject (PdfObject obj, PdfDocument documentTo, bool allowDuplicating, ICopyFilter copyFilter)
  Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo. More...
 
virtual void  WriteToBody (PdfObject pdfObj)
  Writes object to body of PDF document. More...
 
virtual void  WriteHeader ()
  Writes PDF header. More...
 
virtual void  FlushWaitingObjects (ICollection< PdfIndirectReference > forbiddenToFlush)
  Flushes all objects which have not been flushed yet. More...
 
virtual void  FlushModifiedWaitingObjects (ICollection< PdfIndirectReference > forbiddenToFlush)
  Flushes all modified objects which have not been flushed yet. More...
 
- Package Functions inherited from iText.Kernel.Pdf.PdfOutputStream
virtual bool  CheckEncryption (PdfStream pdfStream)
 
virtual bool  ContainsFlateFilter (PdfStream pdfStream)
 
virtual void  UpdateCompressionFilter (PdfStream pdfStream)
 
virtual byte[]  DecodeFlateBytes (PdfStream stream, byte[] bytes)
 

Package Attributes

WriterProperties  properties
 
bool  isUserWarnedAboutAcroFormCopying
 
- Package Attributes inherited from iText.Kernel.Pdf.PdfOutputStream
PdfDocument  document = null
  Document associated with PdfOutputStream. More...
 
PdfEncryption  crypto
  Contains the business logic for cryptography. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from iText.IO.Source.HighPrecisionOutputStream< iText.Kernel.Pdf.PdfOutputStream >
static bool  GetHighPrecision ()
 
static void  SetHighPrecision (bool value)
 
- Protected Member Functions inherited from iText.IO.Source.HighPrecisionOutputStream< iText.Kernel.Pdf.PdfOutputStream >
override void  Dispose (bool disposing)
 
- Protected Attributes inherited from iText.IO.Source.HighPrecisionOutputStream< iText.Kernel.Pdf.PdfOutputStream >
Stream  outputStream
 
- Properties inherited from iText.IO.Source.HighPrecisionOutputStream< iText.Kernel.Pdf.PdfOutputStream >
override bool  CanRead [get]
 
override bool  CanSeek [get]
 
override bool  CanWrite [get]
 
override long  Length [get]
 
override long  Position [get, set]
 

Constructor & Destructor Documentation

◆ PdfWriter() [1/5]

iText.Kernel.Pdf.PdfWriter.PdfWriter ( FileInfo  file )
inline

Create a PdfWriter writing to the passed File and with default writer properties.

Parameters
file File to write to.

◆ PdfWriter() [2/5]

iText.Kernel.Pdf.PdfWriter.PdfWriter ( Stream  os )
inline

Create a PdfWriter writing to the passed outputstream and with default writer properties.

Parameters
os Outputstream to write to.

◆ PdfWriter() [3/5]

iText.Kernel.Pdf.PdfWriter.PdfWriter ( Stream  os,
WriterProperties  properties 
)
inline

Creates PdfWriter instance, which writes to the passed System.IO.Stream , using provided WriterProperties.

Parameters
os

System.IO.Stream in which writing should happen

Parameters
properties

WriterProperties to be used during the writing

◆ PdfWriter() [4/5]

iText.Kernel.Pdf.PdfWriter.PdfWriter ( String  filename )
inline

Create a PdfWriter writing to the passed filename and with default writer properties.

Parameters
filename filename of the resulting pdf.

◆ PdfWriter() [5/5]

iText.Kernel.Pdf.PdfWriter.PdfWriter ( String  filename,
WriterProperties  properties 
)
inline

Create a PdfWriter writing to the passed filename and using the passed writer properties.

Parameters
filename filename of the resulting pdf.
properties writerproperties to use.

Member Function Documentation

◆ CopyObject() [1/2]

virtual PdfObject iText.Kernel.Pdf.PdfWriter.CopyObject ( PdfObject  obj,
PdfDocument  documentTo,
bool  allowDuplicating 
)
inlinepackagevirtual

Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo.

Parameters
obj object to copy
documentTo optional target document
allowDuplicating allow that some objects will become duplicated by this action
Returns
the copies object

◆ CopyObject() [2/2]

virtual PdfObject iText.Kernel.Pdf.PdfWriter.CopyObject ( PdfObject  obj,
PdfDocument  documentTo,
bool  allowDuplicating,
ICopyFilter  copyFilter 
)
inlinepackagevirtual

Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo.

Parameters
obj object to copy
documentTo optional target document
allowDuplicating allow that some objects will become duplicated by this action
copyFilter

iText.Kernel.Utils.ICopyFilter a filter to apply while copying arrays and dictionaries

Returns
the copies object

◆ FlushModifiedWaitingObjects()

virtual void iText.Kernel.Pdf.PdfWriter.FlushModifiedWaitingObjects ( ICollection< PdfIndirectReference forbiddenToFlush )
inlinepackagevirtual

Flushes all modified objects which have not been flushed yet.

Flushes all modified objects which have not been flushed yet. Used in case incremental updates.

Parameters
forbiddenToFlush a Java.Util.Set of references that are forbidden to be flushed automatically.

◆ FlushObject()

virtual void iText.Kernel.Pdf.PdfWriter.FlushObject ( PdfObject  pdfObject,
bool  canBeInObjStm 
)
inlinepackagevirtual

Flushes the object.

Flushes the object. Override this method if you want to define custom behaviour for object flushing.

Parameters
pdfObject object to flush.
canBeInObjStm indicates whether object can be placed into object stream.

◆ FlushWaitingObjects()

virtual void iText.Kernel.Pdf.PdfWriter.FlushWaitingObjects ( ICollection< PdfIndirectReference forbiddenToFlush )
inlinepackagevirtual

Flushes all objects which have not been flushed yet.

Parameters
forbiddenToFlush a Java.Util.Set of references that are forbidden to be flushed automatically.

◆ GetCompressionLevel()

virtual int iText.Kernel.Pdf.PdfWriter.GetCompressionLevel ( )
inlinevirtual

Gets default compression level for

See also
PdfStream.

Gets default compression level for

See also
PdfStream. For more details
iText.IO.Source.DeflaterOutputStream.
Returns
compression level.

◆ GetPdfVersion()

virtual PdfVersion iText.Kernel.Pdf.PdfWriter.GetPdfVersion ( )
inlinevirtual

Gets defined pdf version for the document.

Returns
version for the document

◆ GetProperties()

virtual WriterProperties iText.Kernel.Pdf.PdfWriter.GetProperties ( )
inlinevirtual

Gets the writer properties.

Returns
The WriterProperties of the current PdfWriter.

◆ InitCryptoIfSpecified()

virtual void iText.Kernel.Pdf.PdfWriter.InitCryptoIfSpecified ( PdfVersion  version )
inlinepackagevirtual

Initializes PdfEncryption object if any encryption is specified in WriterProperties.

Parameters
version

PdfVersion version of the document in question

◆ IsFullCompression()

virtual bool iText.Kernel.Pdf.PdfWriter.IsFullCompression ( )
inlinevirtual

Indicates if to use full compression mode.

Returns
true if to use full compression, false otherwise.

◆ SetCompressionLevel()

virtual iText.Kernel.Pdf.PdfWriter iText.Kernel.Pdf.PdfWriter.SetCompressionLevel ( int  compressionLevel )
inlinevirtual

Sets default compression level for

See also
PdfStream.

Sets default compression level for

See also
PdfStream. For more details
iText.IO.Source.DeflaterOutputStream.
Parameters
compressionLevel compression level.
Returns
this PdfWriter instance

◆ SetSmartMode()

virtual iText.Kernel.Pdf.PdfWriter iText.Kernel.Pdf.PdfWriter.SetSmartMode ( bool  smartMode )
inlinevirtual

Sets the smart mode.

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.

Parameters
smartMode True for enabling smart mode.
Returns
this PdfWriter instance

◆ WriteHeader()

virtual void iText.Kernel.Pdf.PdfWriter.WriteHeader ( )
inlinepackagevirtual

Writes PDF header.

◆ WriteToBody()

virtual void iText.Kernel.Pdf.PdfWriter.WriteToBody ( PdfObject  pdfObj )
inlinepackagevirtual

Writes object to body of PDF document.

Parameters
pdfObj object to write.