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(Hashtable annotHash)
This method allows multiple annotations to be added to multiple pages.
|
void |
addDocumentListener(IDocumentListener listener)
Internal method to keep track of document events.
|
void |
addDocumentModifiedListener(com.qoppa.pdf.objectStore.DocumentModificationListener listener)
Internal method to keep track of document events.
|
boolean |
addEmbeddedFile(File file)
Embeds a file into this PDF document.
|
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 |
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 |
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 |
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 |
clearSecurity(String currentPermissionsPwd)
Deprecated.
Use
clearPasswordPermissions(java.lang.String) instead. |
void |
clearUsageRights()
Remove extended permissions from the document.
|
Bookmark |
createRootBookmark()
Creates a new root bookmark and saves it in the document catalog.
|
void |
deleteAnnotations()
Delete all annotations in the document.
|
void |
deletePage(int pageIndex)
Deletes a page from this document.
|
Font |
embedFont(String fileName,
int fontFormat)
Embeds a font in the PDF file.
|
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 a set of 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.
|
void |
flattenAnnotations(boolean paintNonPrintableAnnots)
Flattens the annotations.
|
void |
flattenFields(boolean paintButtons,
boolean paintNonPrintableFields)
Flattens the pdf form fields.
|
void |
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.
|
DocumentInfo |
getDocumentInfo()
Returns an object representing the document metadata information (author, title, etc.).
|
Vector |
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.
|
String |
getFileModifiedID()
Returns the file modified ID.
|
String |
getFileOriginalID()
Returns the file original ID.
|
IPDFPage |
getIPage(int pageIndex)
Internal method, do not use.
|
Layer |
getLayer(int layerIndex)
Returns a particular PDF layer given its index.
|
int |
getLayerCount()
Returns the number of PDF layers in this document.
|
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 |
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.
|
PDFPermissions |
getPermissions()
Deprecated.
Use
getPDFPermissions().getPasswordPermissions() instead. |
PrintSettings |
getPrintSettings()
Get the current PrintSettings object.
|
Bookmark |
getRootBookmark()
Returns the 'root' bookmark.
|
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.
|
Vector |
getWords()
Returns all words in the pdf document as a
Vector of Strings . |
Vector |
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 |
isPortfolio()
Returns a flag indicating whether this document is a PDF Portfolio.
|
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 |
removeDocumentListener(IDocumentListener listener)
Internal method to keep track of document events.
|
boolean |
removeEmbeddedFile(IEmbeddedFile ef)
Remove a file embedded in this document.
|
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 pageNumber)
Sets the initial page to display.
|
void |
setJSOpenAction(JSAction action)
Sets the open action for this document.
|
static boolean |
setKey(String key)
Method to unlock the production version of the library.
|
void |
setMagnification(String magnification)
Sets the magnification at which to display the initial view.
|
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 |
setSecurity(String newPermissionsPwd,
String newOpenPwd,
PasswordPermissions permissions,
String currentPermissionsPwd,
int encryptType)
Deprecated.
Use the new
setPasswordPermission method instead. |
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, addPrintListener, addToASEntry, calculateNow, clearDocMDP, containsJavaScript, findLayer, findPageFromDictionary, getDocumentInfo, getDocumentViewPrefs, getFile, getFileModifiedIDObj, getFileOriginalIDObj, getInitialPage, getJSHandler, getJSOpenAction, getLinearizationVersionNumber, getLinesWithPositions, getMagnification, getNamedDestination, getNamedJavaScript, getOCGs, getPageLayout, getPageMode, getPDFSource, getResourceManager, getWatermark, getWordsWithPositions, getWordsWithPositions, hasEmptyMandatoryField, isCalculate, isLinearized, isTaggedPDF, removePrintListener, rePromptForJavaScript, setCalculate, setContainsJavaScript, setJavaScriptEnabled, setLinearized, setWatermark, 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 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 void addAnnotations(Hashtable 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 void addDocumentModifiedListener(com.qoppa.pdf.objectStore.DocumentModificationListener listener)
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 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.PDFException
IOException
public PDFPage appendNewPage(double pageWidth, double pageHeight) throws PDFException
pageWidth
- Width of the page in 72DPI.pageHeight
- Height of the page in 72DPI.PDFException
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 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. Use 0 for defalte, 1 for jpeg, 2 for jbig2, 3 for jpeg2000.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 clearSecurity(String currentPermissionsPwd) throws PDFException
clearPasswordPermissions(java.lang.String)
instead.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 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 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 exportAnnotsAsFDF(OutputStream outStream, String pathToPDFFile) 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/mydirPDFException
IOException
public void exportAnnotsAsFDF(OutputStream outStream, String pathToPDFFile, Set 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) throws PDFException
fileName
- The name of the file to export the data to.PDFException
public void exportAnnotsAsFDF(String fileName, Set 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) 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/mydirIOException
PDFException
public void exportAnnotsAsXFDF(String fileName) throws PDFException
fileName
- The name of the file to export the data to.PDFException
public void flattenAnnotations(boolean paintNonPrintableAnnots) throws PDFException
paintNonPrintableAnnots
- Flag to indicate whether non-printable annotations should be painted or not.PDFException
public void 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 void 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 interface IPDFDocument
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 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 IPDFPage getIPage(int pageIndex)
getIPage
in interface IPDFDocument
getIPage
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
pageIndex
- Index of the page to return.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 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 getWords() throws PDFException
Vector
of Strings
.PDFException
public Vector getWords(int pageIndex) throws PDFException
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() throws PDFException
PDFException
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 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 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 pageNumber) throws PDFException
pageNumber
- The page number. Use 0 for first page.PDFException
public void setMagnification(String magnification) throws PDFException
magnification
- A string magnification. This value has to be one of:PDFException
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 setSecurity(String newPermissionsPwd, String newOpenPwd, PasswordPermissions permissions, String currentPermissionsPwd, int encryptType) throws PDFException
setPasswordPermission
method instead.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: PDFPermissions.ENCRYPTION_RC4_128, PDFPermissions.ENCRYPTION_RC4_128, PDFPermissions.ENCRYPTION_AES_128, etc...PDFPermissionException
- If currentPermissionsPwd is invalid.PDFException
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 PDFPermissions getPermissions()
getPDFPermissions().getPasswordPermissions()
instead.getPermissions
in interface IPDFDocument
getPermissions
in class com.qoppa.pdfViewer.hiObjects.AbstractPDFDocument
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 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 action) throws PDFException
jsAction
- A JavaScript actionPDFException