|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.DocWriter
com.lowagie.text.pdf.PdfWriter
public class PdfWriter
A DocWriter
class for PDF.
When this PdfWriter
is added
to a certain PdfDocument
, the PDF representation of every Element
added to this Document will be written to the outputstream.
Nested Class Summary | |
---|---|
static class |
PdfWriter.PdfBody
This class generates the structure of a PDF document. |
Field Summary | |
---|---|
static int |
AllowAssembly
The operation permitted when the document is opened with the user password |
static int |
AllowCopy
The operation permitted when the document is opened with the user password |
static int |
AllowDegradedPrinting
The operation permitted when the document is opened with the user password |
static int |
AllowFillIn
The operation permitted when the document is opened with the user password |
static int |
AllowModifyAnnotations
The operation permitted when the document is opened with the user password |
static int |
AllowModifyContents
The operation permitted when the document is opened with the user password |
static int |
AllowPrinting
The operation permitted when the document is opened with the user password |
static int |
AllowScreenReaders
The operation permitted when the document is opened with the user password |
protected PdfWriter.PdfBody |
body
body of the PDF document |
static int |
CenterWindow
A viewer preference |
protected int |
colorNumber
The color number counter for the colors in the document. |
protected PdfEncryption |
crypto
|
protected int |
currentPageNumber
|
protected com.lowagie.text.pdf.PdfReaderInstance |
currentPdfReaderInstance
|
protected PdfDictionary |
defaultColorspace
|
static PdfName |
DID_PRINT
action value |
static PdfName |
DID_SAVE
action value |
protected PdfContentByte |
directContent
The direct content in this document. |
protected PdfContentByte |
directContentUnder
The direct content under in this document. |
static int |
DirectionL2R
A viewer preference |
static int |
DirectionR2L
A viewer preference |
static int |
DisplayDocTitle
A viewer preference |
static PdfName |
DOCUMENT_CLOSE
action value |
protected HashMap |
documentColors
The colors of this document |
protected HashMap |
documentExtGState
|
protected HashMap |
documentFonts
The fonts of this document |
protected HashSet |
documentOCG
|
protected ArrayList |
documentOCGorder
|
protected HashMap |
documentPatterns
The patterns of this document |
protected HashMap |
documentProperties
|
protected HashMap |
documentShadingPatterns
|
protected HashMap |
documentShadings
|
protected HashMap |
documentSpotPatterns
|
static int |
FitWindow
A viewer preference |
protected int |
fontNumber
The font number counter for the fonts in the document. |
protected HashMap |
formXObjects
The form XObjects in this document. |
protected int |
formXObjectsCounter
The name counter for the form XObjects name. |
protected boolean |
fullCompression
Holds value of property fullCompression. |
protected PdfDictionary |
group
|
protected byte[] |
HEADER
this is the header of a PDF document |
static int |
HideMenubar
A viewer preference |
static int |
HideToolbar
A viewer preference |
static int |
HideWindowUI
A viewer preference |
protected PdfDictionary |
imageDictionary
Dictionary, containing all the images of the PDF document |
protected HashMap |
importedPages
|
static float |
NO_SPACE_CHAR_RATIO
Disable the inter-character spacing. |
static int |
NonFullScreenPageModeUseNone
A viewer preference |
static int |
NonFullScreenPageModeUseOC
A viewer preference |
static int |
NonFullScreenPageModeUseOutlines
A viewer preference |
static int |
NonFullScreenPageModeUseThumbs
A viewer preference |
protected PdfArray |
OCGRadioGroup
|
protected PdfOCProperties |
OCProperties
|
static PdfName |
PAGE_CLOSE
action value |
static PdfName |
PAGE_OPEN
action value |
static int |
PageLayoutOneColumn
A viewer preference |
static int |
PageLayoutSinglePage
A viewer preference |
static int |
PageLayoutTwoColumnLeft
A viewer preference |
static int |
PageLayoutTwoColumnRight
A viewer preference |
static int |
PageLayoutTwoPageLeft
A viewer preference |
static int |
PageLayoutTwoPageRight
A viewer preference |
static int |
PageModeFullScreen
A viewer preference |
static int |
PageModeUseAttachments
A viewer preference |
static int |
PageModeUseNone
A viewer preference |
static int |
PageModeUseOC
A viewer preference |
static int |
PageModeUseOutlines
A viewer preference |
static int |
PageModeUseThumbs
A viewer preference |
protected ArrayList |
pageReferences
The PdfIndirectReference to the pages. |
protected com.lowagie.text.pdf.ColorDetails |
patternColorspaceCMYK
|
protected com.lowagie.text.pdf.ColorDetails |
patternColorspaceGRAY
|
protected com.lowagie.text.pdf.ColorDetails |
patternColorspaceRGB
|
protected int |
patternNumber
The patten number counter for the colors in the document. |
protected com.lowagie.text.pdf.PdfDocument |
pdf
the pdfdocument object. |
static int |
PDFX1A2001
PDF/X value |
static int |
PDFX32002
PDF/X value |
static int |
PDFXNONE
PDF/X value |
protected int |
prevxref
|
static int |
PrintScalingNone
A viewer preference |
protected PdfPages |
root
|
static int |
RUN_DIRECTION_DEFAULT
Use the default run direction. |
static int |
RUN_DIRECTION_LTR
Use bidirectional reordering with left-to-right preferential run direction. |
static int |
RUN_DIRECTION_NO_BIDI
Do not use bidirectional reordering. |
static int |
RUN_DIRECTION_RTL
Use bidirectional reordering with right-to-left preferential run direction. |
protected int |
runDirection
|
static int |
SIGNATURE_APPEND_ONLY
signature value |
static int |
SIGNATURE_EXISTS
signature value |
static float |
SPACE_CHAR_RATIO_DEFAULT
The default space-char ratio. |
static boolean |
STRENGTH128BITS
Type of encryption |
static boolean |
STRENGTH40BITS
Type of encryption |
protected PdfStructureTreeRoot |
structureTreeRoot
|
protected boolean |
tagged
|
protected float |
userunit
|
static char |
VERSION_1_2
possible PDF version |
static char |
VERSION_1_3
possible PDF version |
static char |
VERSION_1_4
possible PDF version |
static char |
VERSION_1_5
possible PDF version |
static char |
VERSION_1_6
possible PDF version |
static PdfName |
WILL_PRINT
action value |
static PdfName |
WILL_SAVE
action value |
protected byte[] |
xmpMetadata
XMP Metadata for the document. |
Fields inherited from class com.lowagie.text.DocWriter |
---|
closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB |
Constructor Summary | |
---|---|
protected |
PdfWriter()
|
protected |
PdfWriter(com.lowagie.text.pdf.PdfDocument document,
OutputStream os)
Constructs a PdfWriter . |
Method Summary | |
---|---|
protected PdfIndirectReference |
add(com.lowagie.text.pdf.PdfICCBased icc)
|
void |
addAnnotation(PdfAnnotation annot)
Adds a PdfAnnotation or a PdfFormField
to the document. |
void |
addCalculationOrder(PdfFormField annot)
Adds the PdfAnnotation to the calculation order
array. |
PdfName |
addDirectImageSimple(Image image)
Adds an image to the document but not to the page resources. |
PdfName |
addDirectImageSimple(Image image,
PdfIndirectReference fixedRef)
Adds an image to the document but not to the page resources. |
void |
addFileAttachment(String description,
byte[] fileStore,
String file,
String fileDisplay)
Adds a file attachment at the document level. |
void |
addFileAttachment(String description,
PdfFileSpecification fs)
Adds a file attachment at the document level. |
void |
addJavaScript(PdfAction js)
Adds a JavaScript action at the document level. |
void |
addJavaScript(String code)
Adds a JavaScript action at the document level. |
void |
addJavaScript(String code,
boolean unicode)
Adds a JavaScript action at the document level. |
void |
addOCGRadioGroup(ArrayList group)
Sets a collection of optional content groups whose states are intended to follow a "radio button" paradigm. |
protected void |
addSharedObjectsToBody()
|
PdfIndirectObject |
addToBody(PdfObject object)
Adds an object to the PDF body. |
PdfIndirectObject |
addToBody(PdfObject object,
boolean inObjStm)
Adds an object to the PDF body. |
PdfIndirectObject |
addToBody(PdfObject object,
int refNumber)
Adds an object to the PDF body. |
PdfIndirectObject |
addToBody(PdfObject object,
int refNumber,
boolean inObjStm)
Adds an object to the PDF body. |
PdfIndirectObject |
addToBody(PdfObject object,
PdfIndirectReference ref)
Adds an object to the PDF body. |
PdfIndirectObject |
addToBody(PdfObject object,
PdfIndirectReference ref,
boolean inObjStm)
Adds an object to the PDF body. |
boolean |
breakTableIfDoesntFit(PdfTable table)
Row additions to the original Table used to build the PdfTable are processed and pre-rendered,
and then the contents are deleted. |
void |
close()
Signals that the Document was closed and that no other
Elements will be added. |
void |
createXmpMetadata()
Creates XMP Metadata based on the metadata in the PdfDocument. |
boolean |
fitsPage(PdfPTable table)
Checks if a PdfPTable fits the current page of the PdfDocument . |
boolean |
fitsPage(PdfPTable table,
float margin)
Checks if a PdfPTable fits the current page of the PdfDocument . |
boolean |
fitsPage(Table table)
Checks if a Table fits the current page of the PdfDocument . |
boolean |
fitsPage(Table table,
float margin)
Checks if a Table fits the current page of the PdfDocument . |
void |
freeReader(PdfReader reader)
Writes the reader to the document and frees the memory used by it. |
PdfAcroForm |
getAcroForm()
Gets the AcroForm object. |
Rectangle |
getBoxSize(String boxName)
Gives the size of a trim, art, crop or bleed box, or null if not defined. |
protected PdfDictionary |
getCatalog(PdfIndirectReference rootObj)
|
int |
getCurrentDocumentSize()
Gets the current document size. |
PdfDictionary |
getDefaultColorspace()
Gets the default colorspaces. |
PdfContentByte |
getDirectContent()
Gets the direct content for this document. |
PdfContentByte |
getDirectContentUnder()
Gets the direct content under for this document. |
PdfDictionary |
getExtraCatalog()
Sets extra keys to the catalog. |
PdfDictionary |
getGroup()
Getter for property group. |
PdfImportedPage |
getImportedPage(PdfReader reader,
int pageNumber)
Gets a page from other PDF document. |
PdfDictionary |
getInfo()
Gets the info dictionary for changing. |
static PdfWriter |
getInstance(Document document,
OutputStream os)
Gets an instance of the PdfWriter . |
static PdfWriter |
getInstance(Document document,
OutputStream os,
DocListener listener)
Gets an instance of the PdfWriter . |
protected int |
getNewObjectNumber(PdfReader reader,
int number,
int generation)
|
PdfOCProperties |
getOCProperties()
Gets the Optional Content Properties Dictionary. |
OutputStreamCounter |
getOs()
Returns the outputStreamCounter. |
PdfPageEvent |
getPageEvent()
Gets the PdfPageEvent for this document or null
if none is set. |
int |
getPageNumber()
Gets the current pagenumber of this document. |
PdfIndirectReference |
getPageReference(int page)
Gets a reference to a page existing or not. |
Rectangle |
getPageSize()
Gives the size of the media box. |
PdfIndirectReference |
getPdfIndirectReference()
Gets a PdfIndirectReference for an object that
will be created in the future. |
PdfTable |
getPdfTable(Table table)
Gets a pre-rendered table. |
int |
getPDFXConformance()
Gets the PDFX conformance level. |
PdfOutline |
getRootOutline()
Gets the root outline. |
int |
getRunDirection()
Gets the run direction. |
float |
getSpaceCharRatio()
Gets the space/character extra spacing ratio for fully justified text. |
PdfStructureTreeRoot |
getStructureTreeRoot()
Gets the structure tree root. |
float |
getTableBottom(Table table)
Sometimes it is necessary to know where the just added Table ends. |
float |
getUserunit()
A UserUnit is a value that defines the default user space unit. |
float |
getVerticalPosition(boolean ensureNewLine)
Gets the current vertical page position. |
boolean |
isFullCompression()
Gets the 1.5 compression status. |
boolean |
isStrictImageSequence()
Getter for property strictImageSequence. |
boolean |
isTagged()
Check if the document is marked for tagging. |
void |
open()
Signals that the Document has been opened and that
Elements can be added. |
void |
releaseTemplate(PdfTemplate tp)
Releases the memory used by a template by writing it to the output. |
int |
reorderPages(int[] order)
Reorder the pages in the document. |
void |
setAdditionalAction(PdfName actionType,
PdfAction action)
Additional-actions defining the actions to be taken in response to various trigger events affecting the document as a whole. |
void |
setBoxSize(String boxName,
Rectangle size)
Sets the page box sizes. |
void |
setCropBoxSize(Rectangle crop)
Sets the crop box. |
void |
setDefaultColorspace(PdfName key,
PdfObject cs)
Sets the default colorspace that will be applied to all the document. |
void |
setDuration(int seconds)
Sets the display duration for the page (for presentations) |
void |
setEncryption(boolean strength,
String userPassword,
String ownerPassword,
int permissions)
Sets the encryption options for this document. |
void |
setEncryption(byte[] userPassword,
byte[] ownerPassword,
int permissions,
boolean strength128Bits)
Sets the encryption options for this document. |
void |
setFullCompression()
Sets the document's compression to the new 1.5 mode with object streams and xref streams. |
void |
setGroup(PdfDictionary group)
Setter for property group. |
void |
setLinearPageMode()
Sets the document in a suitable way to do page reordering. |
void |
setOpenAction(PdfAction action)
When the document opens this action will be
invoked. |
void |
setOpenAction(String name)
When the document opens it will jump to the destination with this name. |
boolean |
setOutputIntents(PdfReader reader,
boolean checkExistence)
Copies the output intent dictionary from other document to this one. |
void |
setOutputIntents(String outputConditionIdentifier,
String outputCondition,
String registryName,
String info,
byte[] destOutputProfile)
Sets the values of the output intent dictionary. |
void |
setPageAction(PdfName actionType,
PdfAction action)
Sets the open and close page additional action. |
void |
setPageEmpty(boolean pageEmpty)
If you use setPageEmpty(false), invoking newPage() after a blank page will add a newPage. |
void |
setPageEvent(PdfPageEvent event)
Sets the PdfPageEvent for this document. |
void |
setPageLabels(PdfPageLabels pageLabels)
Sets the page labels |
void |
setPdfVersion(char version)
Sets the PDF version. |
void |
setPDFXConformance(int pdfxConformance)
Sets the PDFX conformance level. |
void |
setRunDirection(int runDirection)
Sets the run direction. |
void |
setSigFlags(int f)
Set the signature flags. |
void |
setSpaceCharRatio(float spaceCharRatio)
Sets the ratio between the extra word spacing and the extra character spacing when the text is fully justified. |
void |
setStrictImageSequence(boolean strictImageSequence)
Sets the image sequence to follow the text in strict order. |
void |
setTagged()
Mark this document for tagging. |
void |
setThumbnail(Image image)
Sets the the thumbnail image for the current page. |
void |
setTransition(PdfTransition transition)
Sets the transition for the page |
void |
setUserunit(float userunit)
A UserUnit is a value that defines the default user space unit. |
void |
setViewerPreferences(int preferences)
Sets the viewer preferences by ORing some constants. |
void |
setXmpMetadata(byte[] xmpMetadata)
Sets XMP Metadata. |
Methods inherited from class com.lowagie.text.DocWriter |
---|
add, add, addTabs, clearTextWrap, flush, getISOBytes, hasMarkupAttributes, isCloseStream, newPage, pause, removeWatermark, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setFooter, setHeader, setMarginMirroring, setMargins, setPageCount, setPageSize, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStart |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PageLayoutSinglePage
public static final int PageLayoutOneColumn
public static final int PageLayoutTwoColumnLeft
public static final int PageLayoutTwoColumnRight
public static final int PageLayoutTwoPageLeft
public static final int PageLayoutTwoPageRight
public static final int PageModeUseNone
public static final int PageModeUseOutlines
public static final int PageModeUseThumbs
public static final int PageModeFullScreen
public static final int PageModeUseOC
public static final int PageModeUseAttachments
public static final int HideToolbar
public static final int HideMenubar
public static final int HideWindowUI
public static final int FitWindow
public static final int CenterWindow
public static final int NonFullScreenPageModeUseNone
public static final int NonFullScreenPageModeUseOutlines
public static final int NonFullScreenPageModeUseThumbs
public static final int NonFullScreenPageModeUseOC
public static final int DirectionL2R
public static final int DirectionR2L
public static final int DisplayDocTitle
public static final int PrintScalingNone
public static final int AllowPrinting
public static final int AllowModifyContents
public static final int AllowCopy
public static final int AllowModifyAnnotations
public static final int AllowFillIn
public static final int AllowScreenReaders
public static final int AllowAssembly
public static final int AllowDegradedPrinting
public static final boolean STRENGTH40BITS
public static final boolean STRENGTH128BITS
public static final PdfName DOCUMENT_CLOSE
public static final PdfName WILL_SAVE
public static final PdfName DID_SAVE
public static final PdfName WILL_PRINT
public static final PdfName DID_PRINT
public static final PdfName PAGE_OPEN
public static final PdfName PAGE_CLOSE
public static final int SIGNATURE_EXISTS
public static final int SIGNATURE_APPEND_ONLY
public static final char VERSION_1_2
public static final char VERSION_1_3
public static final char VERSION_1_4
public static final char VERSION_1_5
public static final char VERSION_1_6
protected byte[] HEADER
protected int prevxref
protected PdfPages root
protected PdfDictionary imageDictionary
protected HashMap formXObjects
protected int formXObjectsCounter
protected int fontNumber
protected int colorNumber
protected int patternNumber
protected PdfContentByte directContent
protected PdfContentByte directContentUnder
protected HashMap documentFonts
protected HashMap documentColors
protected HashMap documentPatterns
protected HashMap documentShadings
protected HashMap documentShadingPatterns
protected com.lowagie.text.pdf.ColorDetails patternColorspaceRGB
protected com.lowagie.text.pdf.ColorDetails patternColorspaceGRAY
protected com.lowagie.text.pdf.ColorDetails patternColorspaceCMYK
protected HashMap documentSpotPatterns
protected HashMap documentExtGState
protected HashMap documentProperties
protected HashSet documentOCG
protected ArrayList documentOCGorder
protected PdfOCProperties OCProperties
protected PdfArray OCGRadioGroup
protected PdfDictionary defaultColorspace
protected float userunit
public static final int PDFXNONE
public static final int PDFX1A2001
public static final int PDFX32002
protected PdfWriter.PdfBody body
protected com.lowagie.text.pdf.PdfDocument pdf
protected PdfEncryption crypto
protected HashMap importedPages
protected com.lowagie.text.pdf.PdfReaderInstance currentPdfReaderInstance
protected ArrayList pageReferences
protected int currentPageNumber
protected PdfDictionary group
public static final float SPACE_CHAR_RATIO_DEFAULT
public static final float NO_SPACE_CHAR_RATIO
public static final int RUN_DIRECTION_DEFAULT
public static final int RUN_DIRECTION_NO_BIDI
public static final int RUN_DIRECTION_LTR
public static final int RUN_DIRECTION_RTL
protected int runDirection
protected byte[] xmpMetadata
protected boolean fullCompression
protected boolean tagged
protected PdfStructureTreeRoot structureTreeRoot
Constructor Detail |
---|
protected PdfWriter()
protected PdfWriter(com.lowagie.text.pdf.PdfDocument document, OutputStream os)
PdfWriter
.
Remark: a PdfWriter can only be constructed by calling the method
getInstance(Document document, OutputStream os)
.
document
- The PdfDocument
that has to be writtenos
- The OutputStream
the writer has to write to.Method Detail |
---|
public static PdfWriter getInstance(Document document, OutputStream os) throws DocumentException
PdfWriter
.
document
- The Document
that has to be writtenos
- The OutputStream
the writer has to write to.
PdfWriter
DocumentException
- on errorpublic static PdfWriter getInstance(Document document, OutputStream os, DocListener listener) throws DocumentException
PdfWriter
.
document
- The Document
that has to be writtenos
- The OutputStream
the writer has to write to.listener
- A DocListener
to pass to the PdfDocument.
PdfWriter
DocumentException
- on errorpublic PdfName addDirectImageSimple(Image image) throws PdfException, DocumentException
Document.add(Image)
.
image
- the Image
to add
PdfException
- on error
DocumentException
- on errorpublic PdfName addDirectImageSimple(Image image, PdfIndirectReference fixedRef) throws PdfException, DocumentException
Document.add(Image)
.
image
- the Image
to addfixedRef
- the reference to used. It may be null
,
a PdfIndirectReference
or a PRIndirectReference
.
PdfException
- on error
DocumentException
- on errorprotected PdfIndirectReference add(com.lowagie.text.pdf.PdfICCBased icc) throws PdfException
PdfException
public void open()
Document
has been opened and that
Elements
can be added.
When this method is called, the PDF-document header is written to the outputstream.
open
in interface DocListener
open
in class DocWriter
protected PdfDictionary getCatalog(PdfIndirectReference rootObj)
protected void addSharedObjectsToBody() throws IOException
IOException
public void close()
Document
was closed and that no other
Elements
will be added.
The pages-tree is built and written to the outputstream. A Catalog is constructed, as well as an Info-object, the referencetable is composed and everything is written to the outputstream embedded in a Trailer.
close
in interface DocListener
close
in class DocWriter
public float getTableBottom(Table table)
Table
ends.
For instance to avoid to add another table in a page that is ending up, because
the new table will be probably splitted just after the header (it is an
unpleasant effect, isn't it?).
Added on September 8th, 2001
by Francesco De Milato
francesco.demilato@tiscalinet.it
table
- the Table
public PdfTable getPdfTable(Table table)
table
- Contains the table definition. Its contents are deleted, after being pre-rendered.
public boolean breakTableIfDoesntFit(PdfTable table) throws DocumentException
Table
used to build the PdfTable
are processed and pre-rendered,
and then the contents are deleted.
If the pre-rendered table doesn't fit, then it is fully rendered and its data discarded.
There shouldn't be any column change in the underlying Table
object.
(Contributed by dperezcar@fcc.es)
table
- The pre-rendered table obtained from getPdfTable(Table)
DocumentException
getPdfTable(Table)
public boolean fitsPage(Table table, float margin)
Table
fits the current page of the PdfDocument
.
table
- the table that has to be checkedmargin
- a certain margin
true
if the Table
fits the page, false
otherwise.public boolean fitsPage(Table table)
Table
fits the current page of the PdfDocument
.
table
- the table that has to be checked
true
if the Table
fits the page, false
otherwise.public boolean fitsPage(PdfPTable table, float margin)
PdfPTable
fits the current page of the PdfDocument
.
table
- the table that has to be checkedmargin
- a certain margin
true
if the PdfPTable
fits the page, false
otherwise.public boolean fitsPage(PdfPTable table)
PdfPTable
fits the current page of the PdfDocument
.
table
- the table that has to be checked
true
if the PdfPTable
fits the page, false
otherwise.public float getVerticalPosition(boolean ensureNewLine)
ensureNewLine
- Tells whether a new line shall be enforced. This may cause side effects
for elements that do not terminate the lines they've started because those lines will get
terminated.
public PdfContentByte getDirectContent()
public PdfContentByte getDirectContentUnder()
public PdfAcroForm getAcroForm()
PdfAcroForm
public PdfOutline getRootOutline()
public OutputStreamCounter getOs()
public PdfIndirectReference getPdfIndirectReference()
PdfIndirectReference
for an object that
will be created in the future.
PdfIndirectReference
public void setPageEvent(PdfPageEvent event)
PdfPageEvent
for this document.
event
- the PdfPageEvent
for this documentpublic PdfPageEvent getPageEvent()
PdfPageEvent
for this document or null
if none is set.
PdfPageEvent
for this document or null
if none is setpublic int getPageNumber()
public void setViewerPreferences(int preferences)
preferences
- the viewer preferencespublic void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits) throws DocumentException
userPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsstrength128Bits
- true
for 128 bit key length, false
for 40 bit key length
DocumentException
- if the document is already openpublic void setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) throws DocumentException
strength
- true
for 128 bit key length, false
for 40 bit key lengthuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissions
DocumentException
- if the document is already openpublic PdfIndirectObject addToBody(PdfObject object) throws IOException
object
-
IOException
public PdfIndirectObject addToBody(PdfObject object, boolean inObjStm) throws IOException
object
- inObjStm
-
IOException
public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref) throws IOException
object
- ref
-
IOException
public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref, boolean inObjStm) throws IOException
object
- ref
- inObjStm
-
IOException
public PdfIndirectObject addToBody(PdfObject object, int refNumber) throws IOException
object
- refNumber
-
IOException
public PdfIndirectObject addToBody(PdfObject object, int refNumber, boolean inObjStm) throws IOException
object
- refNumber
- inObjStm
-
IOException
public void setOpenAction(String name)
name
- the name of the destination to jump topublic void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException
DOCUMENT_CLOSE
,
WILL_SAVE
, DID_SAVE
, WILL_PRINT
and DID_PRINT
.
actionType
- the action typeaction
- the action to execute in response to the trigger
PdfException
- on invalid action typepublic void setOpenAction(PdfAction action)
action
will be
invoked.
action
- the action to be invokedpublic void setPageLabels(PdfPageLabels pageLabels)
pageLabels
- the page labelsprotected int getNewObjectNumber(PdfReader reader, int number, int generation)
public PdfImportedPage getImportedPage(PdfReader reader, int pageNumber)
reader
- the PDF document where the page ispageNumber
- the page number. The first page is 1
public void addJavaScript(PdfAction js)
js
- The JavaScrip actionpublic void addJavaScript(String code, boolean unicode)
code
- the JavaScript codeunicode
- select JavaScript unicode. Note that the internal
Acrobat JavaScript engine does not support unicode,
so this may or may not work for youpublic void addJavaScript(String code)
code
- the JavaScript codepublic void addFileAttachment(String description, byte[] fileStore, String file, String fileDisplay) throws IOException
description
- the file descriptionfileStore
- an array with the file. If it's null
the file will be read from the diskfile
- the path to the file. It will only be used if
fileStore
is not null
fileDisplay
- the actual file name stored in the pdf
IOException
- on errorpublic void addFileAttachment(String description, PdfFileSpecification fs) throws IOException
description
- the file descriptionfs
- the file specification
IOException
public void setCropBoxSize(Rectangle crop)
crop
- the crop boxpublic PdfIndirectReference getPageReference(int page)
page
- the page number. The first page is 1
public void addCalculationOrder(PdfFormField annot)
PdfAnnotation
to the calculation order
array.
annot
- the PdfAnnotation
to be addedpublic void setSigFlags(int f)
f
- the flags. This flags are ORed with current onespublic void addAnnotation(PdfAnnotation annot)
PdfAnnotation
or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.
annot
- the PdfAnnotation
or the PdfFormField
to addpublic void setPdfVersion(char version)
version
- the version numberpublic int reorderPages(int[] order) throws DocumentException
null
argument value
only returns the number of pages to process. It is
advisable to issue a Document.newPage()
before using this method.
order
- an array with the new page sequence. It must have the
same size as the number of pages.
DocumentException
- if all the pages are not present in the arraypublic float getSpaceCharRatio()
public void setSpaceCharRatio(float spaceCharRatio)
spaceCharRatio
times more than extra character spacing.
If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO
then the extra character spacing
will be zero.
spaceCharRatio
- the ratio between the extra word spacing and the extra character spacingpublic void setRunDirection(int runDirection)
runDirection
- the run directionpublic int getRunDirection()
public void setDuration(int seconds)
seconds
- the number of seconds to display the pagepublic void setTransition(PdfTransition transition)
transition
- the Transition objectpublic void freeReader(PdfReader reader) throws IOException
reader
- the PdfReader
to free
IOException
- on errorpublic void setPageAction(PdfName actionType, PdfAction action) throws PdfException
actionType
- the action type. It can be PdfWriter.PAGE_OPEN
or PdfWriter.PAGE_CLOSE
action
- the action to perform
PdfException
- if the action type is invalidpublic int getCurrentDocumentSize()
freeReader()
when concatenating many documents
and an idea of the current size is needed.
public boolean isStrictImageSequence()
public void setStrictImageSequence(boolean strictImageSequence)
strictImageSequence
- new value of property strictImageSequencepublic void setPageEmpty(boolean pageEmpty)
pageEmpty
- the statepublic PdfDictionary getInfo()
public PdfDictionary getExtraCatalog()
public void setLinearPageMode()
public PdfDictionary getGroup()
public void setGroup(PdfDictionary group)
group
- New value of property group.public void setPDFXConformance(int pdfxConformance)
pdfxConformance
- the conformance levelpublic int getPDFXConformance()
public void setOutputIntents(String outputConditionIdentifier, String outputCondition, String registryName, String info, byte[] destOutputProfile) throws IOException
outputConditionIdentifier
- a valueoutputCondition
- a valueregistryName
- a valueinfo
- a valuedestOutputProfile
- a value
IOException
- on errorpublic boolean setOutputIntents(PdfReader reader, boolean checkExistence) throws IOException
reader
- the other documentcheckExistence
- true
to just check for the existence of a valid output intent
dictionary, false
to insert the dictionary if it exists
true
if the output intent dictionary exists, false
otherwise
IOException
- on errorpublic void setBoxSize(String boxName, Rectangle size)
boxName
- the box sizesize
- the sizepublic Rectangle getBoxSize(String boxName)
boxName
- crop, trim, art or bleedpublic Rectangle getPageSize()
public PdfDictionary getDefaultColorspace()
public void setDefaultColorspace(PdfName key, PdfObject cs)
The colorspace is applied immediately when creating templates and at the page end for the main document content.
key
- the name of the colorspace. It can be PdfName.DEFAULTGRAY
, PdfName.DEFAULTRGB
or PdfName.DEFAULTCMYK
cs
- the colorspace. A null
or PdfNull
removes any colorspace with the same namepublic boolean isFullCompression()
true
if the 1.5 compression is onpublic void setFullCompression()
If set before opening the document it will also set the pdf version to 1.5.
public PdfOCProperties getOCProperties()
public void addOCGRadioGroup(ArrayList group)
group
- the radio grouppublic void setThumbnail(Image image) throws PdfException, DocumentException
image
- the image
PdfException
- on error
DocumentException
- or errorpublic float getUserunit()
public void setUserunit(float userunit) throws DocumentException
userunit
- The userunit to set.
DocumentException
public void setXmpMetadata(byte[] xmpMetadata)
xmpMetadata
- The xmpMetadata to set.public void createXmpMetadata()
public void releaseTemplate(PdfTemplate tp) throws IOException
tp
- the template to release
IOException
- on errorpublic void setTagged()
public boolean isTagged()
true
if the document is marked for taggingpublic PdfStructureTreeRoot getStructureTreeRoot()
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |