|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
PDFDocument defines a public interface for manipulating PDF documents. Using a PDFDocument interface, you can programmatically perform the following tasks:
Note: For information about performing these tasks, see the Developer Guide.
| Method Summary | |
void |
deleteAnnotations()
Deletes all annotations in a PDF document. |
void |
deleteFileAttachment(byte[] name)
Deletes a file attachment in a PDF document that is associated with the given name. |
java.io.InputStream |
exportAnnotations()
Exports a PDF document’s annotations as a stream of XFDF XML data. |
FileAttachment |
exportFileAttachment(byte[] name)
Exports data associated with the given name as a FileAttachment object. |
java.io.InputStream |
exportFormData(FormDataFormat format)
Exports a form’s data as an XFA or an XFDF data stream as specified by the format parameter. |
java.io.InputStream |
exportXMP()
Exports the XMP metadata that is associated with a PDF document. |
byte[][] |
getFileAttachmentNames()
Returns an array of names as byte arrays that references file attachments. |
FormType |
getFormType()
Returns the form type on which a PDF document is based. |
java.util.List |
getImages()
Returns a list of all images that are referenced by a PDF document. |
int |
getNumberOfPages()
Returns the number of pages within the PDF document. |
java.lang.String |
getVersion()
Returns the version of the PDF document. |
java.util.ListIterator |
getWords()
Returns a list iterator for accessing the words in the content of the PDF document. |
void |
importAnnotations(java.io.InputStream xfdfAnnotations)
Imports into a PDF document annotations that are represented in an XFDF XML data stream. |
void |
importFileAttachment(byte[] name,
FileAttachment fileAttachment)
Imports the specified FileAttachment object into a PDF document under the given name. |
void |
importFormData(java.io.InputStream src)
Imports the form data as an XFA or an XFDF data stream. |
void |
importXMP(java.io.InputStream src)
Ensures that the input stream that represents XML is valid and uses it to replace the metadata referenced by the PDF document. |
java.io.InputStream |
save()
Returns the modified PDF document data stream. |
java.io.InputStream |
saveAsXDP()
Returns the modified PDF document as an XDP data stream. |
| Method Detail |
public java.lang.String getVersion()
throws PDFException
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public int getNumberOfPages()
throws PDFException
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public FormType getFormType()
throws PDFException
PDFException - If a PDF exception is raised. For more information, see the API Reference.FormType
public java.io.InputStream save()
throws java.io.IOException,
PDFException
java.io.IOException - If the returned java.io.InputStream is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public java.io.InputStream saveAsXDP()
throws java.io.IOException,
PDFException
java.io.IOException - If the returned java.io.InputStream is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public java.io.InputStream exportXMP()
throws java.io.IOException,
PDFException
java.io.IOException - If the returned java.io.InputStream is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public void importXMP(java.io.InputStream src)
throws java.io.IOException,
PDFException
src - A java.io.InputStream containing new metadata.
java.io.IOException - If the java.io.InputStream argument is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public void importFormData(java.io.InputStream src)
throws java.io.IOException,
PDFException
src - A java.io.InputStream object that represents the data to import.
java.io.IOException - If the java.io.InputStream argument is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public java.io.InputStream exportFormData(FormDataFormat format)
throws java.io.IOException,
PDFException
Exports a form’s data as an XFA or an XFDF data stream as specified by the format parameter. A form’s data can only be exported as an XFA data stream if the getFormType method’s return value is FormType.XML_FORM. For information about determining the form type, see the Developer Guide.
format - A FormDataFormat object that specifies whether the form’s data is exported as an XFA or an XFDF data stream.
java.io.IOException - If the returned java.io.InputStream is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public byte[][] getFileAttachmentNames()
throws PDFException
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public void importFileAttachment(byte[] name,
FileAttachment fileAttachment)
throws java.io.IOException,
PDFException
Imports the specified FileAttachment object into a PDF document under the given name. If the specified name already exists, the current data is replaced.
name - A byte array that specifies the name of the file attachment.fileAttachment - A FileAttachment object that is imported into a PDF document.
java.io.IOException - If a Java input error occurs.
PDFException - If a PDF exception is raised. For more information, see the API Reference.FileAttachment
public FileAttachment exportFileAttachment(byte[] name)
throws java.io.IOException,
PDFException
Exports data associated with the given name as a FileAttachment object. This method returns null if the name does not exist.
name - A byte array that specifies the file attachment to export.
java.io.IOException - If a Java input error occurs.
PDFException - If a PDF exception is raised. For more information, see the API Reference.FileAttachment
public void deleteFileAttachment(byte[] name)
throws PDFException
Deletes a file attachment in a PDF document that is associated with the given name. An exception is not thrown if the specified name does not exist. In this situation, this method does not perform any action.
name - A byte array that specifies the name of the file attachment to delete.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public void importAnnotations(java.io.InputStream xfdfAnnotations)
throws java.io.IOException,
PDFException
xfdfAnnotations - A java.io.InputStream object that represents an XFDF data stream containing annotations to import.
java.io.IOException - If the java.io.InputStream argument is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public java.io.InputStream exportAnnotations()
throws java.io.IOException,
PDFException
Exports a PDF document’s annotations as a stream of XFDF XML data. For a complete list of annotations that can be exported, see the Developer Guide.
java.io.IOException - If the returned java.io.InputStream is invalid.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public void deleteAnnotations()
throws PDFException
Deletes all annotations in a PDF document. This method deletes all annotations in a PDF document that were added using XFDF. Individual annotations cannot be deleted. For a complete list of annotations that can be added using XFDF, see the Developer Guide.
PDFException - If a PDF exception is raised. For more information, see the API Reference.
public java.util.List getImages()
throws PDFException
PDFException - If a PDF exception is raised. For more information, see the API Reference.PDFImage
public java.util.ListIterator getWords()
throws PDFException
PDFException - If a PDF exception is raised. For more information, see the API Reference.PDFWord
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||