|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lowagie.text.pdf.PdfStamper
Applies extra content to the pages of a PDF document. This extra content can be all the objects allowed in PdfContentByte including pages from other Pdfs. The original PDF will keep all the interactive elements including bookmarks, links and form fields.
It is also possible to change the field values and to flatten them.
Field Summary | |
private HashMap |
moreInfo
|
protected PdfStamperImp |
stamper
|
Constructor Summary | |
PdfStamper(PdfReader reader,
OutputStream os)
Starts the process of adding extra content to an existing PDF document. |
|
PdfStamper(PdfReader reader,
OutputStream os,
char pdfVersion)
Starts the process of adding extra content to an existing PDF document. |
Method Summary | |
void |
close()
Closes the document. |
AcroFields |
getAcroFields()
Gets the AcroFields object that allows to get and set field values
and to merge FDF forms. |
PdfImportedPage |
getImportedPage(PdfReader reader,
int pageNumber)
Gets a page from other PDF document. |
HashMap |
getMoreInfo()
Gets the optional String map to add or change values in
the info dictionary. |
PdfContentByte |
getOverContent(int pageNum)
Gets a PdfContentByte to write over the page of
the original document. |
PdfContentByte |
getUnderContent(int pageNum)
Gets a PdfContentByte to write under the page of
the original document. |
PdfWriter |
getWriter()
Gets the underlying PdfWriter. |
boolean |
isRotateContents()
Checks if the content is automatically adjusted to compensate the original page rotation. |
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 |
setFormFlattening(boolean flat)
Determines if the fields are flattened on close. |
void |
setMoreInfo(HashMap moreInfo)
An optional String map to add or change values in
the info dictionary. |
void |
setRotateContents(boolean rotateContents)
Flags the content to be automatically adjusted to compensate the original page rotation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected PdfStamperImp stamper
private HashMap moreInfo
Constructor Detail |
public PdfStamper(PdfReader reader, OutputStream os) throws DocumentException, IOException
reader
- the original document. It cannot be reusedos
- the output stream
DocumentException
- on error
IOException
- on errorpublic PdfStamper(PdfReader reader, OutputStream os, char pdfVersion) throws DocumentException, IOException
reader
- the original document. It cannot be reusedos
- the output streampdfVersion
- the new pdf version or '\0' to keep the same version as the original
document
DocumentException
- on error
IOException
- on errorMethod Detail |
public HashMap getMoreInfo()
String
map to add or change values in
the info dictionary.
public void setMoreInfo(HashMap moreInfo)
String
map to add or change values in
the info dictionary. Entries with null
values delete the key in the original info dictionary
moreInfo
- additional entries to the info dictionarypublic void close() throws DocumentException, IOException
DocumentException
- on error
IOException
- on errorpublic PdfContentByte getUnderContent(int pageNum)
PdfContentByte
to write under the page of
the original document.
pageNum
- the page number where the extra content is written
PdfContentByte
to write under the page of
the original documentpublic PdfContentByte getOverContent(int pageNum)
PdfContentByte
to write over the page of
the original document.
pageNum
- the page number where the extra content is written
PdfContentByte
to write over the page of
the original documentpublic boolean isRotateContents()
public void setRotateContents(boolean rotateContents)
true
.
rotateContents
- true
to set auto-rotation, false
otherwisepublic 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 anything was already written to the outputpublic 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 anything was already written to the outputpublic PdfImportedPage getImportedPage(PdfReader reader, int pageNumber)
reader
- the PDF document where the page ispageNumber
- the page number. The first page is 1
public PdfWriter getWriter()
public AcroFields getAcroFields()
AcroFields
object that allows to get and set field values
and to merge FDF forms.
AcroFields
objectpublic void setFormFlattening(boolean flat)
flat
- true
to flatten the fields, false
to keep the fields
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |