public class PdfWriter extends PdfOutputStream
Modifier and Type | Field and Description |
---|---|
protected boolean |
isUserWarnedAboutAcroFormCopying |
protected WriterProperties |
properties |
crypto, document
closeStream, currentPos, outputStream
Constructor and Description |
---|
PdfWriter(File file)
Create a PdfWriter writing to the passed File and with default writer properties.
|
PdfWriter(OutputStream os)
Create a PdfWriter writing to the passed outputstream and with default writer properties.
|
PdfWriter(OutputStream os, WriterProperties properties) |
PdfWriter(String filename)
Create a PdfWriter writing to the passed filename and with default writer properties.
|
PdfWriter(String filename, WriterProperties properties)
Create a PdfWriter writing to the passed filename and using the passed writer properties.
|
Modifier and Type | Method and Description |
---|---|
protected PdfObject |
copyObject(PdfObject obj, PdfDocument documentTo, boolean allowDuplicating)
Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo.
|
protected PdfObject |
copyObject(PdfObject obj, PdfDocument documentTo, boolean allowDuplicating, ICopyFilter copyFilter)
Copies a PdfObject either stand alone or as part of the PdfDocument passed as documentTo.
|
protected void |
flushModifiedWaitingObjects(Set<PdfIndirectReference> forbiddenToFlush)
Flushes all modified objects which have not been flushed yet.
|
protected void |
flushObject(PdfObject pdfObject, boolean canBeInObjStm)
Flushes the object.
|
protected void |
flushWaitingObjects(Set<PdfIndirectReference> forbiddenToFlush)
Flushes all objects which have not been flushed yet.
|
int |
getCompressionLevel()
Gets default compression level for @see PdfStream.
|
protected void |
initCryptoIfSpecified(PdfVersion version) |
boolean |
isFullCompression()
Indicates if to use full compression mode.
|
PdfWriter |
setCompressionLevel(int compressionLevel)
Sets default compression level for @see PdfStream.
|
PdfWriter |
setSmartMode(boolean smartMode)
Sets the smart mode.
|
protected void |
writeHeader()
Writes PDF header.
|
protected void |
writeToBody(PdfObject pdfObj)
Writes object to body of PDF document.
|
checkEncryption, containsFlateFilter, decodeFlateBytes, updateCompressionFilter, write
assignBytes, close, flush, getCurrentPos, getHighPrecision, getLocalHighPrecision, getOutputStream, isCloseStream, reset, setCloseStream, setHighPrecision, setLocalHighPrecision, write, write, write, writeByte, writeByte, writeBytes, writeBytes, writeDouble, writeDouble, writeFloat, writeFloat, writeFloats, writeInteger, writeLong, writeNewLine, writeSpace, writeString
protected WriterProperties properties
protected boolean isUserWarnedAboutAcroFormCopying
public PdfWriter(File file) throws FileNotFoundException
file
- File to write to.
FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
public PdfWriter(OutputStream os)
os
- Outputstream to write to.
public PdfWriter(OutputStream os, WriterProperties properties)
public PdfWriter(String filename) throws FileNotFoundException
filename
- filename of the resulting pdf.
FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
public PdfWriter(String filename, WriterProperties properties) throws FileNotFoundException
filename
- filename of the resulting pdf.
properties
- writerproperties to use.
FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
public boolean isFullCompression()
public int getCompressionLevel()
DeflaterOutputStream
.
public PdfWriter setCompressionLevel(int compressionLevel)
DeflaterOutputStream
.
compressionLevel
- compression level.
PdfWriter
instance
public PdfWriter setSmartMode(boolean smartMode)
smartMode
- True for enabling smart mode.
PdfWriter
instance
protected void initCryptoIfSpecified(PdfVersion version)
protected void flushObject(PdfObject pdfObject, boolean canBeInObjStm)
pdfObject
- object to flush.
canBeInObjStm
- indicates whether object can be placed into object stream.
protected PdfObject copyObject(PdfObject obj, PdfDocument documentTo, boolean allowDuplicating)
obj
- object to copy
documentTo
- optional target document
allowDuplicating
- allow that some objects will become duplicated by this action
protected PdfObject copyObject(PdfObject obj, PdfDocument documentTo, boolean allowDuplicating, ICopyFilter copyFilter)
obj
- object to copy
documentTo
- optional target document
allowDuplicating
- allow that some objects will become duplicated by this action
copyFilter
- ICopyFilter
a filter to apply while copying arrays and dictionaries * Use NullCopyFilter
for no filtering
protected void writeToBody(PdfObject pdfObj)
pdfObj
- object to write.
protected void writeHeader()
protected void flushWaitingObjects(Set<PdfIndirectReference> forbiddenToFlush)
forbiddenToFlush
- a Set
of references
that are forbidden to be flushed automatically.
protected void flushModifiedWaitingObjects(Set<PdfIndirectReference> forbiddenToFlush)
forbiddenToFlush
- a Set
of references
that are forbidden to be flushed automatically.
Copyright © 1998–2022 iText Group NV. All rights reserved.