public class PDFAttachments
extends java.lang.Object
PDFAttachments
represents the attachment set of a PDF
document.
It can be constructed by the following way.
Example:
PDFDocument document = PDFDocument.openDocument(file,password); PDFAttachments pdfAttachments = document.loadAttachments();
PDFAttachment
,
PDFDocument
Modifier and Type | Method and Description |
---|---|
int |
countAttachment()
Get the count of
PDFAttachment object. |
PDFAttachment |
getAttachment(int index)
Get a specific
PDFAttachment object. |
void |
insertAttachment(int index,
PDFAttachment attachment)
Insert an attachment.
|
void |
release()
Release a
PDFAttachments object. |
boolean |
removeAttachment(PDFAttachment attachment)
Remove an attachment.
|
public int countAttachment() throws PDFException
PDFAttachment
object.PDFAttachment
object. It will return 0 if
there is any error.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAttachment
public PDFAttachment getAttachment(int index) throws PDFException
PDFAttachment
object.index
- An integer
value specifies index of
PDFAttachment
object.PDFAttachment
object by index.null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAttachment
public void release() throws PDFException
PDFAttachments
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void insertAttachment(int index, PDFAttachment attachment) throws PDFException
index
- The index of attachment. Range: 0 to (attachementCount-1).
attachementCount
is returned by function
countAttachment()
.attachment
- A PDFAttachment
object that specifies the handle
of the attachment to be inserted. This should be returned by
PDFAttachment.create(PDFDocument)
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAttachment
public boolean removeAttachment(PDFAttachment attachment) throws PDFException
attachment
- A valid PDFAttachment
object which is a PDF
attachment object.true
if removed the specified attachment
successfully, else return false
for not found the
specified attachment.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFAttachment