public class PdfWriter extends PdfOutputStream implements Serializable
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 static int |
calculateIndRefKey(PdfIndirectReference indRef)
Deprecated.
|
void |
close()
Close the writer and underlying streams.
|
protected PdfObject |
copyObject(PdfObject obj, PdfDocument documentTo, boolean allowDuplicating) |
protected void |
flushModifiedWaitingObjects()
Flushes all modified objects which have not been flushed yet.
|
protected void |
flushObject(PdfObject pdfObject, boolean canBeInObjStm)
Flushes the object.
|
protected void |
flushWaitingObjects()
Flushes all objects which have not been flushed yet.
|
int |
getCompressionLevel()
Gets default compression level for @see PdfStream.
|
protected int |
getCopyObjectKey(PdfObject obj)
Deprecated.
Functionality will be removed.
|
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.
|
void |
write(byte[] b)
Write a byte array to the underlying stream
|
void |
write(byte[] b, int off, int len)
Write a slice of the passed byte array to the underlying stream
|
void |
write(int b)
Write an integer to the underlying stream
|
protected void |
writeHeader()
Writes PDF header.
|
protected void |
writeToBody(PdfObject pdfObj)
Writes object to body of PDF document.
|
checkEncryption, containsFlateFilter, decodeFlateBytes, updateCompressionFilter, write
assignBytes, flush, getCurrentPos, getHighPrecision, getOutputStream, isCloseStream, reset, setCloseStream, setHighPrecision, 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
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
public PdfWriter(String filename, WriterProperties properties) throws FileNotFoundException
filename
- filename of the resulting pdf.
properties
- writerproperties to use.
FileNotFoundException
public boolean isFullCompression()
public int getCompressionLevel()
Deflater
.
public PdfWriter setCompressionLevel(int compressionLevel)
Deflater
.
compressionLevel
- compression level.
public PdfWriter setSmartMode(boolean smartMode)
smartMode
- True for enabling smart mode.
public void write(int b) throws IOException
write
in class OutputStream<PdfOutputStream>
b
- integer to write
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream<PdfOutputStream>
b
- byte array to write
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream<PdfOutputStream>
b
- byte array to slice and write.
off
- starting index of the slice.
len
- length of the slice.
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream<PdfOutputStream>
IOException
protected void flushObject(PdfObject pdfObject, boolean canBeInObjStm) throws IOException
pdfObject
- object to flush.
canBeInObjStm
- indicates whether object can be placed into object stream.
IOException
- on error.
protected PdfObject copyObject(PdfObject obj, PdfDocument documentTo, boolean allowDuplicating)
protected void writeToBody(PdfObject pdfObj) throws IOException
pdfObj
- object to write.
IOException
protected void writeHeader()
protected void flushWaitingObjects()
protected void flushModifiedWaitingObjects()
@Deprecated protected static int calculateIndRefKey(PdfIndirectReference indRef)
indRef
- object to be hashed.
@Deprecated protected int getCopyObjectKey(PdfObject obj)
obj
- object to be copied.
Copyright © 1998–2018 iText Group NV. All rights reserved.