com.qoppa.pdfNotes
Interface MutableDocument


public interface MutableDocument

Allow document manipulation within jPDFNotes. This interface is implemented by the documents loaded in PDFNotesBean to allow the host application to perform some document manipulation functions, such as merging of documents, deleting pages and flattening annotations.

Author:
Qoppa Software

Method Summary
 void deletePage(int pageIndex)
          Delete a page in the document.
 void deletePages(int startIndex, int endIndex)
          Deletes a range of pages in the document.
 void exportAnnotsAsFDF(OutputStream outStream, String pathToPDFFile)
          Export the annotation comments to an output stream in FDF format.
 void exportAnnotsAsFDF(OutputStream outStream, String pathToPDFFile, Set annotSet)
          Export the set of annotation comments to an output stream in FDF format.
 void exportAnnotsAsFDF(String fileName)
          Exports annotation comments in FDF format.
 void exportAnnotsAsFDF(String fileName, Set annotSet)
          Exports annotation comments in FDF format.
 void exportAnnotsAsXFDF(OutputStream outStream, String pathToPDFFile)
          Export annotations comments to an output stream in XFDF format.
 void exportAnnotsAsXFDF(String fileName)
          Exports annotations comments in XFDF format to a file.
 void extractPages(int startIndex, int endIndex, OutputStream outStream)
          Creates and saves a new PDF document that contains a range of pages from this document.
 void extractPages(int startIndex, int endIndex, String outputFile)
          Creates and saves a new PDF document that contains a range of pages from this document.
 void flattenAnnotation(Annotation annot, int pageIndex)
          Flattens a single annotation into the content layer.
 void flattenAnnotations()
          Flatten the annotations on this document into the content layer.
 void flattenAnnotations(int pageIndex)
          Flatten the annotations on a page into the content layer.
 void flattenFields(boolean paintButtons, boolean paintNonPrintableFields)
          Flattens all the fields in a document.
 int getPageRotation(int pageIndex)
          Gets the page rotation value, in degrees.
 void importAnnotsFromFDF(InputStream inStream)
          Import annotations comments from an input stream in FDF format.
 void importAnnotsFromFDF(String fileName)
          Import annotations comments from a file in XFDF Format.
 void importAnnotsFromXFDF(InputStream inStream)
          Import annotations comments from an input stream in XFDF format.
 void importAnnotsFromXFDF(String fileName)
          Import annotations comments from a file in FDF Format.
 void insertPage(String inputFile, int targetIndex)
          Insert all pages into this document from another document.
 void insertPages(String inputFile, int srcStartIndex, int srcEndIndex, int targetIndex)
          Insert pages into this document from another document.
 void movePage(int fromIndex, int toIndex)
          Moves a page in a document.
 void setPageRotation(int pageIndex, int degrees)
          Sets the page rotation value for a page.
 

Method Detail

deletePage

void deletePage(int pageIndex)
                throws PDFException
Delete a page in the document.

Parameters:
pageIndex - The page of interest.
Throws:
PDFException

deletePages

void deletePages(int startIndex,
                 int endIndex)
                 throws PDFException
Deletes a range of pages in the document.

Parameters:
startIndex - The first page to delete.
endIndex - The last page to delete, inclusive.
Throws:
PDFException

setPageRotation

void setPageRotation(int pageIndex,
                     int degrees)
                     throws PDFException
Sets the page rotation value for a page. This rotation will change the actual document, not just the view, so when the document is saved, the new rotation will be saved with it.

Parameters:
pageIndex - The index of the page to modify.
degrees - The new rotation for the page, in degrees.
Throws:
PDFException

getPageRotation

int getPageRotation(int pageIndex)
                    throws PDFException
Gets the page rotation value, in degrees. This method retrieves the value of the page rotation in the document, not of the view.

Parameters:
pageIndex - The page of interest.
Returns:
The rotation of the page, in degrees.
Throws:
PDFException

movePage

void movePage(int fromIndex,
              int toIndex)
              throws PDFException
Moves a page in a document.

Parameters:
fromIndex - The index of the page to move.
toIndex - The index of the new location of the page
Throws:
PDFException

extractPages

void extractPages(int startIndex,
                  int endIndex,
                  String outputFile)
                  throws IOException,
                         PDFException
Creates and saves a new PDF document that contains a range of pages from this document.

Parameters:
startIndex - The first page to include in the new document.
endIndex - The last page to include in the new document.
outputFile - The path to the file to save the PDF document in.
Throws:
IOException - Any errors writing the file
PDFException - Any errors extracting the pages

extractPages

void extractPages(int startIndex,
                  int endIndex,
                  OutputStream outStream)
                  throws IOException,
                         PDFException
Creates and saves a new PDF document that contains a range of pages from this document.

Parameters:
startIndex - The first page to include in the new document.
endIndex - The last page to include in the new document.
outStream - The output stream to write the resulting PDF to.
Throws:
IOException - Any errors writing the file
PDFException - Any errors extracting the pages

insertPages

void insertPages(String inputFile,
                 int srcStartIndex,
                 int srcEndIndex,
                 int targetIndex)
                 throws PDFException
Insert pages into this document from another document.

Parameters:
inputFile - The path to the PDF file to get pages from.
srcStartIndex - The first page from the input file to insert, inclusive.
srcEndIndex - The last page from the input file to insert, inclusive.
targetIndex - The location on the current document where the pages will be inserted.
Throws:
PDFException

insertPage

void insertPage(String inputFile,
                int targetIndex)
                throws PDFException
Insert all pages into this document from another document.

Parameters:
inputFile - The path to the PDF file to get pages from.
targetIndex - The location on the current document where the pages will be inserted.
Throws:
PDFException

flattenAnnotations

void flattenAnnotations()
                        throws PDFException
Flatten the annotations on this document into the content layer. After annotations are flattened, they will be part of the PDF content and will not be editable anymore. This method will flatten all the annotations in the entire document.

Throws:
PDFException

flattenAnnotations

void flattenAnnotations(int pageIndex)
                        throws PDFException
Flatten the annotations on a page into the content layer. After annotations are flattened, they will be part of the PDF content and will not be editable anymore.

Parameters:
pageIndex - The index of the page (0 based) on which to flatten the annotations.
Throws:
PDFException

flattenAnnotation

void flattenAnnotation(Annotation annot,
                       int pageIndex)
                       throws PDFException
Flattens a single annotation into the content layer. After annotations are flattened, they will be part of the PDF content and will not be editable anymore.

Parameters:
annot - The annotation to flatten.
pageIndex - The index of the page (0 based) on which the annotation is located.
Throws:
PDFException

flattenFields

void flattenFields(boolean paintButtons,
                   boolean paintNonPrintableFields)
                   throws PDFException
Flattens all the fields in a document. After the fields are flattened, their content becomes part of the document content and so they are not editable anymore.

Parameters:
paintButtons - Flag to indicate whether buttons should be flattened into the content. If false, buttons will be removed. If true, buttons will become part of the content.
paintNonPrintableFields - Flag to indicate whether fields flagged as non-printable should be flattened or removed.
Throws:
PDFException

exportAnnotsAsXFDF

void exportAnnotsAsXFDF(OutputStream outStream,
                        String pathToPDFFile)
                        throws PDFException,
                               IOException
Export annotations comments to an output stream in XFDF format.

Parameters:
outStream - The output stream to write the data to.
pathToPDFFile - is the relative path from the xfdf file to the pdf file name. This parameter can be left null. This parameter is used to fill the pdf file name entry in the XFDF file, the file entry will be set to pathToPDFFile + fileName The file entry is used when you open an xfdf file to be able to locate the corresponding pdf file. Example of pathToPDFFile ../qoppa/mydir
Throws:
PDFException
IOException

exportAnnotsAsFDF

void exportAnnotsAsFDF(String fileName)
                       throws PDFException
Exports annotation comments in FDF format.

Parameters:
fileName - The name of the file to export the data to.
Throws:
PDFException

exportAnnotsAsFDF

void exportAnnotsAsFDF(String fileName,
                       Set annotSet)
                       throws PDFException
Exports annotation comments in FDF format.

Parameters:
fileName - The name of the file to export the data to.
annotSet - The set of annotations to export. If annotSet is not null, only the annotations contained in the set will be exported. Otherwise, all annotations will be exported.
Throws:
PDFException

exportAnnotsAsXFDF

void exportAnnotsAsXFDF(String fileName)
                        throws PDFException
Exports annotations comments in XFDF format to a file.

Parameters:
fileName - The name of the file to export the data to.
Throws:
PDFException

exportAnnotsAsFDF

void exportAnnotsAsFDF(OutputStream outStream,
                       String pathToPDFFile)
                       throws PDFException,
                              IOException
Export the annotation comments to an output stream in FDF format.

Parameters:
outStream - The output stream to write the data to.
pathToPDFFile - is the relative path from the FDF file to the PDF file name. This parameter can be left null. This parameter is used to fill the PDF file name entry in the FDF file, the file entry will be set to pathToPDFFile + fileName. The file entry is used when you open an FDF file to be able to locate the corresponding PDF file. Example of pathToPDFFile ../qoppa/mydir
Throws:
PDFException
IOException

exportAnnotsAsFDF

void exportAnnotsAsFDF(OutputStream outStream,
                       String pathToPDFFile,
                       Set annotSet)
                       throws PDFException,
                              IOException
Export the set of annotation comments to an output stream in FDF format.

Parameters:
outStream - The output stream to write the data to.
pathToPDFFile - is the relative path from the FDF file to the PDF file name. This parameter can be left null. This parameter is used to fill the PDF file name entry in the FDF file, the file entry will be set to pathToPDFFile + fileName. The file entry is used when you open an FDF file to be able to locate the corresponding PDF file. Example of pathToPDFFile ../qoppa/mydir
annotSet - The set of annotations to export. If annotSet is not null, only the annotations contained in the set will be exported. Otherwise, all annotations will be exported.
Throws:
PDFException
IOException

importAnnotsFromXFDF

void importAnnotsFromXFDF(String fileName)
                          throws PDFException
Import annotations comments from a file in FDF Format.

Parameters:
fileName - The name of the FDF file to import the data from.
Throws:
PDFException

importAnnotsFromXFDF

void importAnnotsFromXFDF(InputStream inStream)
                          throws PDFException
Import annotations comments from an input stream in XFDF format.

Parameters:
inStream - The input stream in XFDF format to read the data from.
Throws:
PDFException

importAnnotsFromFDF

void importAnnotsFromFDF(String fileName)
                         throws PDFException
Import annotations comments from a file in XFDF Format.

Parameters:
fileName - The name of the XFDF file to import the data from.
Throws:
PDFException

importAnnotsFromFDF

void importAnnotsFromFDF(InputStream inStream)
                         throws PDFException
Import annotations comments from an input stream in FDF format.

Parameters:
inStream - The input stream in FDF format to read the data from.
Throws:
PDFException