public class PDFDocument
extends com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
Modifier and Type | Class and Description |
---|---|
static class |
PDFDocument.KeyInfoProcess
This is the Main-Class for the jPDFProcess.jar that can generate server
key requests, validate a key, and display server information.
|
MAGNIFICATION_FIT_ACTUAL, MAGNIFICATION_FIT_HEIGHT, MAGNIFICATION_FIT_PAGE, MAGNIFICATION_FIT_VISIBLE, MAGNIFICATION_FIT_WIDTH, PAGELAYOUT_ONECOLUMN, PAGELAYOUT_SINGLEPAGE, PAGELAYOUT_TWOCOLUMNLEFT, PAGELAYOUT_TWOCOLUMNRIGHT, PAGELAYOUT_TWOPAGELEFT, PAGELAYOUT_TWOPAGERIGHT, PAGEMODE_FULLSCREEN, PAGEMODE_USEATTACHMENTS, PAGEMODE_USENONE, PAGEMODE_USEOC, PAGEMODE_USEOUTLINES, PAGEMODE_USETHUMBS
NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
PDFDocument()
Creates a blank PDF document.
|
PDFDocument(InputStream inStream,
IPassword password)
Creates a PDFDocument object from a PDF InputStream.
|
PDFDocument(PDFSource source,
IPassword password)
Create a PDFDocument object using a PDFSource interface.
|
PDFDocument(String fileName,
IPassword password)
Loads a PDF document from a file.
|
PDFDocument(URL url,
IPassword password)
Loads a PDF document from a URL.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnnotations(Map<Integer,Vector<Annotation>> annotHash)
This method allows multiple annotations to be added to multiple pages.
|
void |
addDocumentListener(IDocumentListener listener)
Internal method to keep track of document events.
|
boolean |
addEmbeddedFile(File file)
Embeds a file into this PDF document.
|
IEmbeddedFile |
addEmbeddedFile(File file,
EmbedFileOptions options)
Embeds a file into this PDF document, with options.
|
boolean |
addEmbeddedFile(InputStream inStream,
String fileName,
Date modDate,
Date creationDate)
Embeds a file into this PDF document.
|
IEmbeddedFile |
addEmbeddedFile(InputStream inStream,
String fileName,
Date modDate,
Date creationDate,
EmbedFileOptions options)
Embeds a file into this PDF document, with options.
|
Layer |
addLayer(String name,
int initialState)
Creates and returns a PDF layer (Optional Content Group).
|
Layer |
addLayer(String name,
int initialState,
boolean showInList)
Creates and returns a PDF layer (Optional Content Group).
|
void |
addPageFromTemplate(String templateName,
int pageIndex)
Add a page from a template.
|
void |
addPrintListener(PrintListener printListener)
Adds a
PrintListener to the PDFDocument |
void |
appendDocument(PDFDocument appendDoc)
Appends a PDF document to this document.
|
void |
appendGIFAsPage(InputStream gifStream,
int dpi)
Creates a new page in the PDF document and adds the GIF image to it.
|
void |
appendGIFAsPage(String gifFileName,
int dpi)
Creates a new page in the PDF document and adds the GIF image to it.
|
void |
appendGIFAsPage(String gifFileName,
int dpi,
int compression)
Creates a new page in the PDF document and adds the GIF image to it.
|
void |
appendImage(File imageFile)
This method appends an image (or series of images) to the current document.
|
void |
appendImage(InputStream inStream,
String formatName)
This method appends an image (or series of images) to the current document.
|
void |
appendImageAsPage(BufferedImage image,
double pageWidth,
double pageHeight,
int compressionType)
Creates a new page, with given dimensions, in the PDF document and adds the image to it.
|
void |
appendImageAsPage(BufferedImage original,
int compressionType,
int colorSpace,
int dpi)
Creates a new page in the PDF document and adds the image to it.
|
void |
appendJPEG2000AsPage(InputStream inStream,
int dpi)
Creates a new page in the PDF document and adds a JPEG200 image, read from an input stream, to it using the DPI specified.
|
void |
appendJPEGAsPage(InputStream inStream)
Creates a new page in the PDF document and adds the JPEG image to it.
|
void |
appendJPEGAsPage(String jpegFileName)
Creates a new page in the PDF document and adds the JPEG file to it.
|
void |
appendJPEGAsPage(String jpegFileName,
int dpi)
Creates a new page in the PDF document and adds the JPEG file to it.
|
PDFPage |
appendNewPage(double pageWidth,
double pageHeight)
Creates and appends a new PDFPage to this document.
|
PDFPage |
appendPage(PDFPage page)
Appends a page to this document.
|
void |
appendPNGAsPage(InputStream inStream)
Creates a new page in the PDF document and adds a PNG image, read from an input stream, to it.
|
void |
appendPNGAsPage(String pngFileName)
Creates a new page in the PDF document and adds the PNG file to it.
|
void |
appendTextAsPages(InputStream textStream,
TextToPDFSettings settings)
Creates new pages in the PDF document and adds the text, read from an
input stream, to them.
|
void |
appendTextAsPages(String txtFileName,
TextToPDFSettings settings)
Creates new pages in the PDF document and adds the text from an text file
to them.
|
void |
appendTIFFAsPages(InputStream inStream)
Appends the pages in a TIFF image from an input stream to the end of this document.
|
void |
appendTIFFAsPages(String tiffFileName)
Appends the pages in a TIFF file to the end of this document.
|
void |
clearPasswordPermissions(String currentPermissionsPwd)
Clears the password permissions for this document.
|
void |
clearUsageRights()
Remove extended permissions from the document.
|
void |
close()
Close / release all resources held by this document.
|
Bookmark |
createRootBookmark()
Creates a new root bookmark and saves it in the document catalog.
|
void |
createTemplateFromPage(int pageIndex,
String templateName,
boolean visible)
Create a template based off an existing page in the document
|
void |
deleteAnnotations()
Delete all annotations in the document.
|
void |
deletePage(int pageIndex)
Deletes a page from this document.
|
void |
deletePageRange(int startPageIx,
int endPageIx)
Delete a set of pages from this document.
|
Font |
embedFont(InputStream instream,
int fontFormat)
Embeds a font in the PDF file.
|
Font |
embedFont(String fileName,
int fontFormat)
Embeds a font in the PDF file.
|
void |
exportAnnotsAsCSV(OutputStream outStream)
Export annotations comments to an output stream in CSV format.
|
void |
exportAnnotsAsCSV(String fileName)
Exports annotations comments in CSV format.
|
void |
exportAnnotsAsFDF(OutputStream outStream,
String pathToPDFFile,
Set<Annotation> annotSet)
Export the set of annotation comments to an output stream in FDF format.
|
void |
exportAnnotsAsFDF(String fileName,
Set<Annotation> annotSet)
Exports a set of annotation comments in FDF format.
|
void |
exportAnnotsAsXFDF(OutputStream outStream,
String pathToPDFFile,
Set<Annotation> annotSet)
Export annotations comments to an output stream in XFDF format.
|
void |
exportAnnotsAsXFDF(String fileName,
Set<Annotation> annotSet)
Exports annotations comments in XFDF format.
|
void |
fireDocumentEvent(DocumentEvent de) |
int |
flattenAnnotations(boolean paintNonPrintableAnnots)
Flattens the annotations.
|
int |
flattenFields(boolean paintButtons,
boolean paintNonPrintableFields)
Flattens the pdf form fields.
|
int |
flattenFields(boolean paintButtons,
boolean paintOnlyImageButtons,
boolean paintNonPrintableFields)
Flattens the pdf form fields.
|
AcroForm |
getAcroForm()
Returns the AcroForm in this document.
|
IAnnotationFactory |
getAnnotationFactory()
Returns the AnnotationFactory for this document.
|
Vector<String> |
getDestinationNames()
Get a vector of strings that are the names of named destinations (saved locations
in the document used for links, bookmarks, buttons etc.).
|
DocumentInfo |
getDocumentInfo()
Returns an object representing the document metadata information (author, title, etc.).
|
DocumentViewPrefs |
getDocumentViewPrefs()
Returns a DocumentViewPrefs object containing information about the
way the document is to be presented on the screen or in print.
|
Vector<IEmbeddedFile> |
getEmbeddedFiles()
Returns the list of embedded files in the document (annotations attachments are not part of the list).
|
String |
getEncryptionAlgorithm()
Returns the name of the encryption algorithm used to encrypt the document.
|
int |
getEncryptionLength()
Returns an int representing the number of bits used in the encryption technique.
|
int |
getEncryptionType()
Get the encryption type used to encrypt the document (PasswordPermissions.ENCRYPTION_RC4_128, PasswordPermissions.ENCRYPTION_RC4_128, PasswordPermissions.ENCRYPTION_AES_128, etc...).
|
String |
getFileModifiedID()
Returns the file modified ID.
|
String |
getFileOriginalID()
Returns the file original ID.
|
IPDFPage |
getIPage(int pageIndex)
Returns an object that implements IPDFPage given the page index.
|
Layer |
getLayer(int layerIndex)
Returns a particular PDF layer given its index.
|
int |
getLayerCount()
Returns the number of PDF layers in this document.
|
String |
getLinearizationVersionNumber()
Returns the linearization version number.
|
String |
getMagnification()
Deprecated.
Use getOpenAction()
|
Action |
getOpenAction()
Returns the Action to run when the document is opened.
|
PDFPage |
getPage(int pageIndex)
Returns a page in this document.
|
Pageable |
getPageable(PrinterJob pJob)
Returns an object that implements Pageable for this PDF document.
|
int |
getPageCount()
Returns the number of pages in this document.
|
String |
getPageLayout()
Returns the value of the page layout key for this document.
|
String |
getPageMode()
Returns the value of the page mode viewer preference in the document.
|
String |
getPDFFileVersion()
Return the PDF file version for the current document.
|
AllPDFPermissions |
getPDFPermissions()
Returns the AllPDFPermissions object which encompasses this document's PasswordPermissions, DocMDPPermissions, and UsageRightsPermissions.
|
PDFSource |
getPDFSource()
Returns an object representing the source of the PDF content.
|
PrintSettings |
getPrintSettings()
Get the current PrintSettings object.
|
IResourceManager |
getResourceManager()
Returns the IResourceManager for this document.
|
Bookmark |
getRootBookmark()
Returns the 'root' bookmark.
|
Vector<String> |
getTemplateNames()
Get a vector of strings that are the names of templates.
|
String |
getText()
Returns the text in the pdf document as a
String . |
String |
getText(int pageIndex)
Returns text contained in the specified page of the pdf document
as a String.
|
static String |
getVersion()
Returns version string for jPDFProcess.
|
IWatermark |
getWatermark()
Returns the watermark for the PDF document.
|
Vector<String> |
getWords()
Returns all words in the pdf document as a
Vector of Strings . |
Vector<String> |
getWords(int pageIndex)
Returns all words contained in the specified page of the pdf document
as a Vector of Strings.
|
boolean |
hasOpenPassword()
Returns a flag indicating whether this document is encrypted with a 'user' password.
|
boolean |
hasPermissionsPassword()
Returns a flag indicating whether this document is encrypted with a 'owner' password.
|
Object |
importAnnotsFDF(InputStream inStream)
Import annotations comments from an input stream in FDF format.
|
Object |
importAnnotsFDF(String fileName)
Import annotations comments from a file in FDF Format.
|
Object |
importAnnotsPDF(PDFDocument sourcePDF)
Import annotations from another PDFDocument.
|
Object |
importAnnotsXFDF(InputStream inStream)
Import annotations from an input stream in XFDF Format.
|
Object |
importAnnotsXFDF(String fileName)
Import annotations from a file in XFDF Format.
|
PDFPage |
insertNewPage(double pageWidth,
double pageHeight,
int index)
Creates a new PDFPage and inserts it into the document at the given position.
|
PDFPage |
insertPage(PDFPage page,
int index)
Inserts a page into this document at the given index.
|
boolean |
isDocumentModified()
Returns a flag indicating whether this document has been modified.
|
boolean |
isEncrypted()
Returns a flag indicating whether this document is encrypted.
|
boolean |
isLinearized()
Returns true if document is formatted for Fast Web View.
|
boolean |
isPortfolio()
Returns a flag indicating whether this document is a PDF Portfolio.
|
static void |
loadLicense(InputStream licenseStream)
Method to load a license file from an inputstream.
|
static void |
loadLicense(String licenseFile)
Method to load a license file.
|
static PDFDocument |
loadRTF(String rtfFile,
PageFormat pf)
Creates a PDFDocument from an RTF file.
|
void |
movePage(int currentIndex,
int newIndex)
moves an existing page to a new location.
|
int |
print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
Prints the page.
|
void |
print(PrintSettings printSettings)
Prints this PDF document.
|
void |
print(String printerName,
PrintSettings printSettings)
Prints this PDF document to the specified printer, by name.
|
void |
print(String printerName,
PrintSettings printSettings,
PrintRequestAttributeSet printAttrSet)
Prints this PDF document to the specified printer, by name and passes the print request attribute set to the printer job.
|
void |
printAsImage(String printerName,
PrintSettings printSettings,
PrintRequestAttributeSet printAttrSet)
Prints this document by first converting each page to an image and then sending the image to the printer.
|
void |
printAsImage(String printerName,
PrintSettings printSettings,
PrintRequestAttributeSet printAttrSet,
int dpi)
Prints this document by first converting each page to an image and then sending the image to the printer.
|
void |
removeDocumentListener(IDocumentListener listener)
Internal method to keep track of document events.
|
boolean |
removeEmbeddedFile(IEmbeddedFile ef)
Remove a file embedded in this document.
|
void |
removePrintListener(PrintListener printListener)
Removes a
PrintListener from the PDFDocument |
void |
removeTemplate(String templateName)
Remove an existing template.
|
void |
saveDocument(OutputStream outStream)
Saves this document to an output stream.
|
void |
saveDocument(String fileName)
Saves this document to a file.
|
void |
saveDocumentAsTIFF(OutputStream outStream,
double resDPI,
String tiffCompression)
Save the entire document as a multi-page TIFF image to the given OutputStream.
|
void |
saveDocumentAsTIFF(OutputStream outStream,
TIFFOptions options)
Save the entire document as a multi-page TIFF image to an OutputStream.
|
void |
saveDocumentLinearized(OutputStream outputStream)
Saves this document as a linearized PDF document, for faster web viewing.
|
void |
setInitialPage(int pageIndex,
String scale)
Sets the initial page and scale to use when this document is opened with a PDF viewer.
|
void |
setJSOpenAction(JSAction jsAction)
Sets the open action for this document.
|
static boolean |
setKey(String key)
Method to unlock the production version of the library.
|
void |
setPageLabels(int[] indices,
String prefix,
String style,
int offset)
Sets a page label to identify each page visually on the screen or in
print.
|
void |
setPageLayout(String pageLayout)
Changes the value of the page layout key for this document.
|
void |
setPageMode(String pageMode)
Changes the value of the page mode viewer preference in the document.
|
void |
setPasswordPermissions(String newPermissionsPwd,
String newOpenPwd,
PasswordPermissions permissions,
String currentPermissionsPwd,
int encryptType)
Sets the security for this document.
|
void |
setPDFFileVersion(int majorVersion,
int minorVersion)
Set the PDF file version.
|
void |
setPrintSettings(PrintSettings printSettings)
Set the PrintSettings to be used on the next printout.
|
void |
setWatermark(IWatermark watermark)
Sets the watermark on the PDF document.
|
void |
signDocument(SignatureField signField,
SigningInformation signingInfo)
Signs this document using the given signature field.
|
boolean |
usePermissionsPassword(String password)
Tells the PDFDocument object that the permissions password is known, so all permissions are granted.
|
addEmbeddedFile, addToASEntry, calculateNow, clearDocMDP, containsJavaScript, findLayer, findPageFromReference, getAdditionalActions, getDocumentInfo, getFile, getFileModifiedIDObj, getFileOriginalIDObj, getJSHandler, getJSOpenAction, getLinesWithPositions, getNamedDestination, getNamedJavaScript, getOCGs, getPageLabel, getPageLabelIndex, getPDFCollection, getPrintListeners, getWordsWithPositions, getWordsWithPositions, hasEmptyMandatoryField, isCalculate, isTaggedPDF, setAdditionalActions, setCalculate, setLinearized, setNamedJavaScript, updateOCDefaultConfig, verifySignatures
public PDFDocument() throws PDFException
PDFException
public PDFDocument(InputStream inStream, IPassword password) throws PDFException
inStream
- InputStream to read the pdf document from.password
- An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword
class that can hold a single
password or a list of passwords.PDFException
public PDFDocument(PDFSource source, IPassword password) throws PDFException
source
- The source of the PDF content.password
- The password, if any, used to open the document. Set to null if there is no password needed.PDFException
public PDFDocument(String fileName, IPassword password) throws PDFException
fileName
- Name of the PDF file.password
- An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword
class that can hold a single
password or a list of passwords.PDFException
public PDFDocument(URL url, IPassword password) throws PDFException
url
- URL pointing to the location of the PDF file.password
- An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword
class that can hold a single
password or a list of passwords.PDFException
public void close()
close
in interface IPDFDocument
close
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public static String getVersion()
public static PDFDocument loadRTF(String rtfFile, PageFormat pf) throws PDFException, IOException, BadLocationException
rtfFile
- - Name of the RTF file.pf
- - PageFormat to use when creating pages in the PDF document.PDFException
IOException
BadLocationException
public static boolean setKey(String key)
key
- Production key.public static void loadLicense(InputStream licenseStream) throws LicenseException
licenseStream
- The input stream for the license file contents.LicenseException
- If there are any problems with the license filepublic static void loadLicense(String licenseFile) throws LicenseException, IOException
licenseFile
- The full path to the license file.LicenseException
- If there are any problems with the license fileIOException
public void addAnnotations(Map<Integer,Vector<Annotation>> annotHash) throws PDFException
Integer
s for the keys representing the page index. The values in the
hashtable must be Vector
s of Annotations
.annotHash
- The hashtable of annotations to be added to the document.PDFException
public void addDocumentListener(IDocumentListener listener)
addDocumentListener
in interface IPDFDocument
addDocumentListener
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public Layer addLayer(String name, int initialState) throws PDFException
name
- The name of the layer. This name will show up on a PDF viewer to turn the layer on or off.initialState
- The initial visibility state of the layer. This determines whether the layer will be
visible or not when the PDF document is opened. Valid values for this are Layer.STATE_ON or Layer.STATE_OFF.PDFException
public Layer addLayer(String name, int initialState, boolean showInList) throws PDFException
name
- The name of the layer. This name will show up on a PDF viewer to turn the layer on or off.initialState
- The initial visibility state of the layer. This determines whether the layer will be
visible or not when the PDF document is opened. Valid values for this are Layer.STATE_ON or Layer.STATE_OFF.showInList
- Flag to indicate whether this layer should be shown in the list of layers when the
document is opened in a PDF viewerPDFException
public void appendDocument(PDFDocument appendDoc) throws PDFException
appendDoc
- Document to be appended.PDFException
- PDFDocument
is equal to
appendDoc
PDFDocument
has an AcroForm with XFA
data and appendDoc
has an AcroForm.appendDoc
has an AcroForm with XFA
data and this PDFDocument
has an AcroFormAcroForm.removeXFA()
public void appendGIFAsPage(InputStream gifStream, int dpi) throws PDFException, IOException
gifStream
- The name of gif filedpi
- The DPI value to use when importing the image.PDFException
IOException
public void appendGIFAsPage(String gifFileName, int dpi) throws PDFException, IOException
gifFileName
- The name of gif filedpi
- The DPI value to use when importing the image.PDFException
IOException
public void appendGIFAsPage(String gifFileName, int dpi, int compression) throws PDFException, IOException
gifFileName
- The name of gif filedpi
- The DPI value to use when importing the image.compression
- The compression type to use when importing the image.PDFException
IOException
public void appendImage(File imageFile) throws PDFException, IOException
imageFile
- The input image file. The format of the input file is determined by looking
at the extension.PDFException
IOException
public void appendImage(InputStream inStream, String formatName) throws IOException, PDFException
inStream
- The input stream holding the image contents.formatName
- The name of the format of the input content data. Valid format names are pdf, tiff,
tif, png, jpg, jpeg and jpe and are case insensitive.IOException
PDFException
public void appendJPEGAsPage(InputStream inStream) throws PDFException, IOException
inStream
- the input stream to read the JPEG image fromPDFException
IOException
public void appendJPEGAsPage(String jpegFileName) throws PDFException, IOException
jpegFileName
- The name of the JPEG file to add to this document.PDFException
IOException
public void appendJPEGAsPage(String jpegFileName, int dpi) throws PDFException, IOException
jpegFileName
- The name of the JPEG file to add to this document.dpi
- The DPI value to use to determine the size of the page to create. This value overrides any DPI value inside the JPEG file.PDFException
IOException
public PDFPage appendNewPage(double pageWidth, double pageHeight) throws PDFException
pageWidth
- Width of the page. The dimensions are given in PostScript
points. 1 inch = 72 points, 1cm = 28.3465 points, 1mm = 2.8346 pointspageHeight
- Height of the page. The dimensions are given in PostScript
points. 1 inch = 72 points, 1cm = 28.3465 points, 1mm = 2.8346 pointsPDFException
public PDFPage appendPage(PDFPage page) throws PDFException
movePage(int, int)
method.page
- The page to add to the document.PDFException
- PDFDocument
has an AcroForm with XFA
data and page
's PDFDocument
has an
AcroForm.page
's PDFDocument
has an
AcroForm with XFA data and this PDFDocument
has
an AcroFormAcroForm.removeXFA()
public void appendPNGAsPage(InputStream inStream) throws PDFException, IOException
inStream
- The input stream to read the PNG image from.PDFException
IOException
public void appendPNGAsPage(String pngFileName) throws PDFException, IOException
pngFileName
- The name of the PNG file to add to this document.PDFException
IOException
public void appendJPEG2000AsPage(InputStream inStream, int dpi) throws IOException, PDFException
inStream
- Input stream to the JPEG 2000 iamge.dpi
- The DPI of the input imageIOException
PDFException
public void appendImageAsPage(BufferedImage image, double pageWidth, double pageHeight, int compressionType) throws PDFException, IOException
image
- The image for the new page.pageWidth
- The width for the new page.pageHeight
- The height for the new page.compressionType
- The compressionType for the image. See ImageCompression
.PDFException
IOException
public void appendImageAsPage(BufferedImage original, int compressionType, int colorSpace, int dpi) throws PDFException, IOException
original
- The image for the new page.compressionType
- The compression type for the image. See ImageCompression
.colorSpace
- The color space for the image. See ImageColorSpace
.dpi
- The dpi of the image.PDFException
IOException
public void appendTextAsPages(InputStream textStream, TextToPDFSettings settings) throws PDFException
textStream
- The input stream to read the text from.settings
- The object to set the text to PDF settings.PDFException
public void appendTextAsPages(String txtFileName, TextToPDFSettings settings) throws PDFException, IOException
txtFileName
- The name of the text file to add to this document.settings
- The object to set the text to PDF settings.PDFException
- , IOExceptionIOException
public void appendTIFFAsPages(InputStream inStream) throws PDFException, IOException
inStream
- The input stream to read the TIFF image fromPDFException
IOException
public void appendTIFFAsPages(String tiffFileName) throws PDFException, IOException
tiffFileName
- The name of the TIFF file to add to this document.PDFException
IOException
public void clearPasswordPermissions(String currentPermissionsPwd) throws PDFException
currentPermissionsPwd
- The current permissions password in the document, if any. This password is needed to be able to change the passwords and
permissions in a document.PDFPermissionException
- If currentPermissionsPwd is invalid.PDFException
public Bookmark createRootBookmark() throws PDFException
PDFException
public void deleteAnnotations() throws PDFException
PDFException
public void deletePage(int pageIndex) throws PDFException
pageIndex
- Index of the page to remove.PDFException
public void exportAnnotsAsCSV(OutputStream outStream) throws PDFException
outStream
- The output stream to write the data to.PDFException
public void exportAnnotsAsCSV(String fileName) throws PDFException
fileName
- The name of the file to export the data to.PDFException
public void exportAnnotsAsFDF(OutputStream outStream, String pathToPDFFile, Set<Annotation> annotSet) throws PDFException, IOException
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/mydirannotSet
- 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.PDFException
IOException
public void exportAnnotsAsFDF(String fileName, Set<Annotation> annotSet) throws PDFException
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.PDFException
public void exportAnnotsAsXFDF(OutputStream outStream, String pathToPDFFile, Set<Annotation> annotSet) throws PDFException
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 + fileNa The file entry is used
when you open an fdf file to be able to locate the
corresponding pdf file. Example of pathToPDFFile
../qoppa/mydirannotSet
- 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.PDFException
public void exportAnnotsAsXFDF(String fileName, Set<Annotation> annotSet) throws PDFException
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.PDFException
public int flattenAnnotations(boolean paintNonPrintableAnnots) throws PDFException
paintNonPrintableAnnots
- Flag to indicate whether non-printable annotations should be painted or not.PDFException
public int flattenFields(boolean paintButtons, boolean paintNonPrintableFields) throws PDFException
paintButtons
- Flag to indicate whether push buttons should be painted or not.paintNonPrintableFields
- Flag to indicate whether non-printable fields should be painted or not.PDFException
public int flattenFields(boolean paintButtons, boolean paintOnlyImageButtons, boolean paintNonPrintableFields) throws PDFException
paintButtons
- Flag to indicate whether push buttons should be painted or not.paintOnlyImageButtons
- Flag to indicate that push buttons should only be painted if they have an image (only matters if paintButtons is true)paintNonPrintableFields
- Flag to indicate whether non-printable fields should be painted or not.PDFException
public IAnnotationFactory getAnnotationFactory()
getAnnotationFactory
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public AcroForm getAcroForm()
getAcroForm
in interface IPDFDocument
getAcroForm
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public DocumentInfo getDocumentInfo()
getDocumentInfo
in interface IPDFDocument
getDocumentInfo
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public Vector<IEmbeddedFile> getEmbeddedFiles()
getEmbeddedFiles
in interface IPDFDocument
getEmbeddedFiles
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public String getEncryptionAlgorithm()
public int getEncryptionLength()
public String getFileModifiedID()
getFileModifiedID
in interface IPDFDocument
getFileModifiedID
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public String getFileOriginalID()
getFileOriginalID
in interface IPDFDocument
getFileOriginalID
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public Layer getLayer(int layerIndex)
getLayer
in interface IPDFDocument
getLayer
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public int getLayerCount()
getLayerCount
in interface IPDFDocument
getLayerCount
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public PDFPage getPage(int pageIndex)
pageIndex
- Index of the page to return.public Pageable getPageable(PrinterJob pJob)
getPageable
in interface IPDFDocument
getPageable
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
pJob
- PrinterJob object where the Pageable will be used.public int getPageCount()
getPageCount
in interface IPDFDocument
getPageCount
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public String getPDFFileVersion()
public PrintSettings getPrintSettings()
getPrintSettings
in interface IPDFDocument
getPrintSettings
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public PDFSource getPDFSource()
getPDFSource
in interface IPDFDocument
getPDFSource
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public Bookmark getRootBookmark()
getRootBookmark
in interface IPDFDocument
getRootBookmark
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public String getText() throws PDFException
String
. Pages are separated with a return char.getText
in interface IPDFDocument
getText
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
PDFException
public String getText(int pageIndex) throws PDFException
getText
in interface IPDFDocument
getText
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
pageIndex
- is the 0 based page number. pageIndex = 0 is the first page of the document.PDFException
public Vector<String> getWords() throws PDFException
Vector
of Strings
.PDFException
public Vector<String> getWords(int pageIndex) throws PDFException
getWordsWithPositions(int, String)
getWords
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
pageIndex
- is the 0 based page number. pageIndex = 0 is the first page of the document.PDFException
public boolean hasOpenPassword()
public boolean hasPermissionsPassword()
public Object importAnnotsFDF(InputStream inStream) throws PDFException
inStream
- The input stream in FDF format to read the data from.PDFException
public Object importAnnotsFDF(String fileName) throws PDFException
fileName
- The name of the FDF file to import the data from.PDFException
public Object importAnnotsXFDF(InputStream inStream) throws PDFException
inStream
- The input stream in XML format to read the data from.PDFException
public Object importAnnotsXFDF(String fileName) throws PDFException
fileName
- The name of the XML file to import the annotations from.PDFException
public Object importAnnotsPDF(PDFDocument sourcePDF) throws PDFException
sourcePDF
- The PDF document to import the annotations from.PDFException
public PDFPage insertNewPage(double pageWidth, double pageHeight, int index) throws PDFException
pageWidth
- Width of the page in 72DPI.pageHeight
- Height of the page in 72DPI.PDFException
public PDFPage insertPage(PDFPage page, int index) throws PDFException
movePage(int, int)
method.
If the index is less than 0, the page is inserted as the first page. If the index is greater than the number of pages in the document, the page is appended to the document.
page
- The page to add to the document.index
- Location where to insert the new page.PDFException
- PDFDocument
has an AcroForm with XFA
data and page
's PDFDocument
has an
AcroForm.page
's PDFDocument
has an AcroForm with XFA data and this
PDFDocument
has an AcroFormAcroForm.removeXFA()
public boolean isDocumentModified()
public boolean isEncrypted()
public boolean isPortfolio()
isPortfolio
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public void movePage(int currentIndex, int newIndex) throws PDFException
currentIndex
- The current index of the page to move.newIndex
- The location to move the page.PDFException
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
print
in interface Printable
print
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
PrinterException
public void print(PrintSettings printSettings) throws PDFPermissionException, PrinterException
print
in interface IPDFDocument
print
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
printSettings
- Print job settings. Use this object to tell jPDFProcess how to print the document. If null, the library will print using default
settings.PDFPermissionException
PrinterException
public void print(String printerName, PrintSettings printSettings) throws PDFPermissionException, PrinterException
printSettings
- Print job settings. Use this object to tell the library how to print the document. If null, the library will print using default
settings.printerName
- The name of the printer to print to. If this parameter is set to null, the method will print to the default printer.PrinterException
- This exception is thrown if the printer is not found or if there is an error while printing.PDFPermissionException
public void print(String printerName, PrintSettings printSettings, PrintRequestAttributeSet printAttrSet) throws PDFPermissionException, PrinterException
print
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
printSettings
- Print job settings. Use this object to tell the library how to print the document. If null, the library will print using default
settings.printerName
- The name of the printer to print to. If this parameter is set to null, the method will print to the default printer.printAttrSet
- The attribute set to pass to the printer. This parameter simply gets passed through to the printer job to set options
such as the media tray, chromaticity and others. If null is passed, the print job will use default attributes.PrinterException
- This exception is thrown if the printer is not found or if there is an error while printing.PDFPermissionException
public void printAsImage(String printerName, PrintSettings printSettings, PrintRequestAttributeSet printAttrSet) throws PDFPermissionException, PrinterException
printerName
- The name of the printer to print to. If this parameter
is set to null, the method will print to the default printer.printSettings
- Print job settings. Use this object to tell
the library how to print the document. If null, the library will
print using default settings.printAttrSet
- The attribute set to pass to the printer. This parameter simply gets passed through to the printer job to set options
such as the media tray, chromaticity and others. If null is passed, the print job will use default attributes.dpi
- PDFPermissionException
- This exception is thrown if the PDF does not allow for printing.PrinterException
- This exception is thrown if the printer is not
found or if there is an error while printing.PrinterException
public void printAsImage(String printerName, PrintSettings printSettings, PrintRequestAttributeSet printAttrSet, int dpi) throws PDFPermissionException, PrinterException
printerName
- The name of the printer to print to. If this parameter
is set to null, the method will print to the default printer.printSettings
- Print job settings. Use this object to tell
the library how to print the document. If null, the library will
print using default settings.printAttrSet
- The attribute set to pass to the printer. This parameter simply gets passed through to the printer job to set options
such as the media tray, chromaticity and others. If null is passed, the print job will use default attributes.dpi
- The DPI resolution used to print the image. If 0, the default printer DPI is used.PDFPermissionException
- This exception is thrown if the PDF does not allow for printing.PrinterException
- This exception is thrown if the printer is not
found or if there is an error while printing.PrinterException
public void removeDocumentListener(IDocumentListener listener)
removeDocumentListener
in interface IPDFDocument
removeDocumentListener
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public boolean removeEmbeddedFile(IEmbeddedFile ef) throws IOException, PDFException
ef
- the embedded file to removeIOException
PDFException
public boolean addEmbeddedFile(File file) throws IOException, PDFException
file
- The file to embed in the documentIOException
PDFException
public IEmbeddedFile addEmbeddedFile(File file, EmbedFileOptions options) throws IOException, PDFException
file
- The file to embed in the documentoptions
- Options to set in the embedded file data.IOException
PDFException
public boolean addEmbeddedFile(InputStream inStream, String fileName, Date modDate, Date creationDate) throws IOException, PDFException
inStream
- The input stream to embed.fileName
- The name of the embedded file.modDate
- The modification date of the embedded file.creationDate
- The creation date of the embedded file.IOException
PDFException
public IEmbeddedFile addEmbeddedFile(InputStream inStream, String fileName, Date modDate, Date creationDate, EmbedFileOptions options) throws IOException, PDFException
inStream
- The input stream to embed.fileName
- The name of the embedded file.modDate
- The modification date of the embedded file.creationDate
- The creation date of the embedded file.options
- Options to set in the embedded file data.IOException
PDFException
public void saveDocument(OutputStream outStream) throws IOException, PDFException
outStream
- OutputStream where the document will be written to.IOException
PDFException
public void saveDocument(String fileName) throws IOException, PDFException
fileName
- Name of the file to save the document.IOException
PDFException
public void saveDocumentAsTIFF(OutputStream outStream, double resDPI, String tiffCompression) throws PDFException, IOException
outStream
- The stream to save the image to.resDPI
- Dots per inch at which to render the image, 72 is the native PDF resolution and is equivalent to 100% scale..tiffCompression
- The type of TIFF compression to use. This value needs to be one of
these predefined values:PDFException
IOException
public void saveDocumentAsTIFF(OutputStream outStream, TIFFOptions options) throws PDFException, IOException
TIFFOptions
object as an argument to describe various
TIFF options when saving the file.outStream
- The stream to save the image to.options
- Options to use when saving the TIFF file.PDFException
IOException
public void setInitialPage(int pageIndex, String scale) throws PDFException
pageIndex
- The index of the page (0 based) to display upon opening the document. If this value is -1, this method will clear
the initial page entry.scale
- The scale to use when displaying the page. This argument can be one of the followingPDFException
public void setPageLayout(String pageLayout) throws PDFException
pageLayout
- The new page mode. This value has to be one of:PDFException
public void setPageMode(String pageMode) throws PDFException
pageMode
- The new page mode. This value has to be one of:PDFException
public void setPrintSettings(PrintSettings printSettings)
setPrintSettings
in interface IPDFDocument
setPrintSettings
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
printSettings
- Settings to use on the next printout.public void setPasswordPermissions(String newPermissionsPwd, String newOpenPwd, PasswordPermissions permissions, String currentPermissionsPwd, int encryptType) throws PDFException
newPermissionsPwd
- The document's permissions password.newOpenPwd
- The document's open password.permissions
- Permission object.currentPermissionsPwd
- The current permissions password in the document, if any. This password is needed to be able to change the passwords and
permissions in a document.encryptType
- The encryption type to use: PasswordPermissions.ENCRYPTION_RC4_128, PasswordPermissions.ENCRYPTION_RC4_128, PasswordPermissions.ENCRYPTION_AES_128, etc...PDFPermissionException
- If currentPermissionsPwd is invalid.PDFException
public final AllPDFPermissions getPDFPermissions()
getPDFPermissions
in interface IPDFDocument
getPDFPermissions
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public void clearUsageRights() throws PDFException
clearUsageRights
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
PDFException
public void signDocument(SignatureField signField, SigningInformation signingInfo) throws PDFException
signField
- The field to use to sign the document.signingInfo
- Information required to sign the document.PDFException
SignatureAppearance
public boolean usePermissionsPassword(String password) throws PDFException
password
- The permissions passwordPDFException
public Vector<String> getDestinationNames() throws PDFException
getDestinationNames
in interface IPDFDocument
getDestinationNames
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
PDFException
public Vector<String> getTemplateNames() throws PDFException
getTemplateNames
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
PDFException
public void deletePageRange(int startPageIx, int endPageIx) throws PDFException
startPageIx
- The index of the first page to delete.endPageIx
- The inclusive index of the last page.PDFException
- Throwns if there is an error deleting the pages.public void fireDocumentEvent(DocumentEvent de)
public Font embedFont(InputStream instream, int fontFormat) throws IOException, FontFormatException, PDFException
instream
- Input stream to read the font data from.fontFormat
- Font format. This can be Font.TRUETYPE_FONT or Font.TYPE1_FONTIOException
FontFormatException
PDFException
public Font embedFont(String fileName, int fontFormat) throws IOException, FontFormatException, PDFException
fileName
- Name of the font file.fontFormat
- Font format. This can be Font.TRUETYPE_FONT or Font.TYPE1_FONT (if using JDK1.5)IOException
FontFormatException
PDFException
public void saveDocumentLinearized(OutputStream outputStream) throws PDFException, IOException
outputStream
- The output stream to write the PDF contents to.PDFException
IOException
public void setPDFFileVersion(int majorVersion, int minorVersion)
majorVersion
- The integer part of the versionminorVersion
- The decimal part of the versionpublic void setJSOpenAction(JSAction jsAction) throws PDFException
jsAction
- A JavaScript actionPDFException
public int getEncryptionType()
public String getPageMode()
getPageMode
in interface IPDFDocument
getPageMode
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public String getMagnification()
getMagnification
in interface IPDFDocument
getMagnification
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public String getPageLayout()
getPageLayout
in interface IPDFDocument
getPageLayout
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public IPDFPage getIPage(int pageIndex)
getIPage
in interface IPDFDocument
getIPage
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
pageIndex
- Index of the page to return.public String getLinearizationVersionNumber()
getLinearizationVersionNumber
in interface IPDFDocument
getLinearizationVersionNumber
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public boolean isLinearized()
isLinearized
in interface IPDFDocument
isLinearized
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public void addPrintListener(PrintListener printListener)
PrintListener
to the PDFDocumentaddPrintListener
in interface IPDFDocument
addPrintListener
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
printListener
- - the PrintListener
to be addedpublic void removePrintListener(PrintListener printListener)
PrintListener
from the PDFDocumentremovePrintListener
in interface IPDFDocument
removePrintListener
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
printListener
- - the PrintListener
to be removedpublic DocumentViewPrefs getDocumentViewPrefs()
getDocumentViewPrefs
in interface IPDFDocument
getDocumentViewPrefs
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public Action getOpenAction()
getOpenAction
in interface IPDFDocument
getOpenAction
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public IResourceManager getResourceManager()
getResourceManager
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
public void setWatermark(IWatermark watermark)
IWatermark.TYPE_IMAGES
,
IWatermark.TYPE_PRINT
, IWatermark.TYPE_VIEWER
when creating images, printing, and viewing the PDF document,
respectively.setWatermark
in interface IPDFDocument
setWatermark
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
watermark
- the IWatermark
object to use when creating
images, printing, and viewing the PDF documentpublic IWatermark getWatermark()
getWatermark
in interface IPDFDocument
getWatermark
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
IWatermark
objectsetWatermark(com.qoppa.pdf.IWatermark)
public void setPageLabels(int[] indices, String prefix, String style, int offset) throws PDFException
indices
- The page indices with this page label.prefix
- The label prefix for page labels in this range.style
- The numbering style to be used for the numeric portion of each
page label: PageLabels.DECIMAL_NUMERALS,
PageLabels.UPPERCASE_ROMAN_NUMERALS,
PageLabels.LOWERCASE_ROMAN_NUMERALS,
PageLabels.UPPERCASE_LETTERS, PageLabels.LOWERCASE_LETTERS.offset
- The value of the numeric portion for the first page label in
the range. Subsequent pages are numbered sequentially from
this value, which must be greater than or equal to 1.PDFException
public void createTemplateFromPage(int pageIndex, String templateName, boolean visible) throws PDFException
pageIndex
- is the 0 based page number. pageIndex = 0 is the first page of the document.templateName
- is a unique name for the template to be created. Check getTemplateNames()
to see if a name already exists.visible
- a boolean indicating if the template should be visible (remains a regular page in the document)
or invisible (removes the page from document, but still exists and is available to create pages from).PDFException
public void removeTemplate(String templateName) throws PDFException
templateName
- is the name of the template to be removed.PDFException
public void addPageFromTemplate(String templateName, int pageIndex) throws PDFException
addPageFromTemplate
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
templateName
- The name of the template.pageIndex
- The index to insert the page.PDFException