iText 8.0.5 API
iText.Kernel.Pdf.PdfWriter Class Reference
Inheritance diagram for iText.Kernel.Pdf.PdfWriter:
iText.Kernel.Pdf.PdfOutputStream iText.IO.Source.OutputStream< 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)
 
  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 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.OutputStream< iText.Kernel.Pdf.PdfOutputStream >
bool?  GetLocalHighPrecision ()
 
void  SetLocalHighPrecision (bool value)
 
  OutputStream (Stream outputStream)
 
  OutputStream (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)
 
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.OutputStream< iText.Kernel.Pdf.PdfOutputStream >
static bool  GetHighPrecision ()
 
static void  SetHighPrecision (bool value)
 
- Protected Member Functions inherited from iText.IO.Source.OutputStream< iText.Kernel.Pdf.PdfOutputStream >
override void  Dispose (bool disposing)
 
- Properties inherited from iText.IO.Source.OutputStream< 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/4]

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/4]

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/4]

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() [4/4]

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.

◆ GetProperties()

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

Gets the writer properties.

Returns
The WriterProperties of the current PdfWriter.

◆ 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.