File representing PDF content
This class also used in (click to expand):
AudioFile.toPdf(String, String)
DatasetFile.toPdf(String, String)
Document.addPdfPage(int, PdfFile, int)
Document.appendPdf(PdfFile)
Document.toPdf(String, boolean)
DocumentFile.toPdf(String, String)
ExcelFile.toPdf(String, String)
File.toPdf(String, String)
ImageFile.toPdf(String, String)
InstallerPal.getPdfDocument(String)
InternalDevelopmentPal.getPdfDocument(String)
InternalPalInfo.getPdfDocument(String)
Packet.createPdfDocument(PdfFile, String, String)
Page.toPdf(String)
Pal.getPdfDocument(String)
Render.toDocumentPdf(String)
Render.toPdf(String)
RuntimePal.getPdfDocument(String)
ShellPal.getPdfDocument(String)
SmartDoc.getPdf()
SmartDoc.setPdf(PdfFile)
TransactionPacket.createPdfDocument(PdfFile, String, String)
Upload.toPdf(String, String)
VCardFile.toPdf(String, String)
|
|
addPage(int destinationPage, PdfFile sourcePdf, int sourcePage)
Adds the page from the source PDF to this PDF at the specified location. Controlled by Max Export Size of activation key.
|
|
Data
|
analyze()
Performs a top level analysis of the PDF and returns summary information.
|
|
|
appendPdf(PdfFile sourcePdf)
Appends the source PDF to this PDF. Controlled by Max Export Size of activation key.
|
|
boolean
|
applyExternalSignature(Payload signatureResult)
Assembles a CMS SignedData structure from the pieces gathered from GlobalSign DSS and embeds it, along with the timestamp token, into the placeholder reserved by prepareExternalSignature(), completing an AATL-trusted signature. Throws WorkflowException immediately if prepareExternalSignature() wasn't called first. Returns false - without throwing - if any of the five required values are missing or empty, or if the assembled signature and timestamp exceed the reserved placeholder size. Any other unexpected failure (decode error, internal fault) is caught and rethrown as WorkflowException. Whether this call succeeds, returns false, or throws, the prepared placeholder state is cleared - a failed attempt cannot be retried without calling prepareExternalSignature() again.
|
|
String
|
calcMD5()
Returns an MD5 checksum of the contents of this file.
|
|
|
clip(int x, int y, int w, int h)
If file is an image type, clips the image
|
|
|
closeReader()
Resets the capability to read lines to the beginning of the file.
|
|
File
|
copy()
Returns a copy of the file
|
|
ImageFile
|
copy()
Returns a copy of the file
|
|
PdfFile
|
copyCompatible()
Creates a new PdfFile with version 1.5 or greater, making it compatible for usage as a Document.
|
|
FileBuffer
|
createFileBuffer()
Reads this compressed file and returns a FileBuffer. Throws exception if this not a supported type (zip and jar).
|
|
boolean
|
createPdfTamperSeal()
Creates a Digital Signature 'tamper seal' on this file. This should be called only once, when all data have been applied. Returns false if this method has already been applied to the file.
|
|
ImageFile
|
createSprite(int spacing, int padding, float scale, boolean horizontal, boolean includePageNumbers)
Creates a sprite image for the PDF. Restricted by max upload of the activation key and by the cloud max pdf page count.
|
|
ImageFile
|
createSprite(int spacing, int padding, int height, int width, boolean horizontal, boolean includePageNumbers)
Creates a sprite image for the PDF. Restricted by max upload of the activation key and by the cloud max pdf page count. Height and width will not exceed 30% of normal page size.
|
|
boolean
|
decrypt(String password)
Sets password for pdf decryption. Call this method before any other modification method if pdf file is password protected. Returns false if decryption fails.
|
|
File
|
decrypt(String password, String filename)
Returns a new file. Assumes the content of this file is PGP encrypted.
|
|
boolean
|
deletePage(int pageNumber)
Deletes the specified page. Returns false if the page cannot be deleted.
|
|
File
|
encrypt(String password)
Returns a new file with the content of this file PGP encrypted. The new file's filename will be existing filename+.txt
|
|
File
|
encrypt(String password, String filename)
Returns a new file with the content of this file PGP encrypted having the specified file name. Extensions allowed: pgp, gpg, txt, asc. Extension is required.
|
|
String
|
getContentType()
Returns the content type of this file
|
|
String
|
getFailureMessage()
When isValid is false, contains failure message.
|
|
String
|
getFileExtension()
Returns the file extension. 'Myfile.doc' returns 'doc'
|
|
int
|
getFileLength()
Returns the size of the file in bytes.
|
|
int
|
getFileSize()
Returns the size of the file in kilobytes.
|
|
String
|
getFileType()
Returns the type of the file as specified by the upload tag or API. This may be null if the file was obtained by means other than an upload.
|
|
String
|
getFilename()
Returns the name of the uploaded file (without the full path).
|
|
int
|
getHeight()
Returns image height
|
|
Data
|
getImageMetadata()
Returns metadata of this image file (not all of which might be present): longitude,latitude,date,camera,manufacturer,focalLength,fStop,exposureTime,isoSpeedRatings
shutterSpeedValueAPEX,shutterSpeedExposureTime,apertureValueAPEX,subjectDistance,dateTimeOriginal,orientation,height,width,p0-p12. p0-p12 contains pixel colors for 13 points on the image in hex.
|
|
Payload
|
getNativeLayer()
Obtains the native layer for this PDF from the underlying content. Changes to this layer are not persisted.
|
|
ImageFile
|
getPage(String filename, int page, float scale, boolean grayscale)
Creates a PNG of the specified page.
|
|
int
|
getPageCount()
Returns the number of pages in this PDF.
|
|
DataReader
|
getReader()
Opens a data reader for this file. File type should be list compatible.
|
|
DataList
|
getSpriteMap(String name)
Returns a DataList containing sprite coordinate information that can be used to create an HTML image map for the sprite. Call createSprite before calling this method.
|
|
TiffBuilder
|
getTiffBuilder()
Returns a new TiffBuilder for this PdfFile. Throws exception if the content is invalid.
|
|
int
|
getWidth()
Returns image width
|
|
XMLReader
|
getXMLReader(boolean removeNamespaces)
Returns a ServicePayload for processing XML-based files. Returns null if the file is not XML.
|
|
|
hidePdfMenubar()
Adds viewer setting to not display its menu bar
|
|
|
hidePdfToolbar()
Adds viewer setting to not display its toolbar
|
|
|
hidePdfUI()
Adds viewer setting to not display its UI
|
|
boolean
|
isAdHocConversionSupported()
Returns true if the content supports immediate conversion to adhoc. See Packet.createAdHocDocument(File,...)
|
|
boolean
|
isCompatible()
Returns true if this PDF can be converted to a Document.
|
|
boolean
|
isCorrectType()
Returns true if the type of the file is within the specified restriction.
|
|
boolean
|
isDataListSupported()
Returns true if this file content can be used as a DataList. See Attachment.toDataList
|
|
boolean
|
isEncrypted()
Checks if this pdf file is password protected
|
|
boolean
|
isMacro()
Returns true if the content of the file contains macro.
|
|
boolean
|
isPdfConversionSupported()
Returns true if the content supports conversion to PDF.
|
|
boolean
|
isPdfValid()
Returns true if the content of the file is valid PDF. This will return false for encrypted PDFs or any non PDF files.
|
|
boolean
|
isSealed()
Returns true if this PDF has been tamper sealed.
|
|
boolean
|
isSizeExceeded()
Returns true if the size of the file exceeds the specified restriction.
|
|
boolean
|
isValid()
Returns true if the content of the file is valid.
|
|
boolean
|
isVirus()
Returns true if the content of the file contains a virus.
|
|
File
|
pgpDecrypt(File keyFile, String password, String filename)
Returns a new file with the content of this PGP encrypted file decrypted using the provided private key. The content type is guessed from the file name extension
|
|
File
|
pgpEncrypt(File keyFile)
Returns a new file with the content of this file PGP encrypted using the provided public key. The new file's filename will be existing filename+.txt
|
|
Data
|
prepareExternalSignature(int reservedSize, String digestAlgorithm)
Reserves a placeholder of reservedSize bytes in the PDF's signature dictionary for an externally-generated (e.g. third-party AATL) signature, and returns a 'digest' entry containing the hex-encoded digest of the byte range outside that placeholder. Retains placeholder state on this instance until applyExternalSignature() is called. Neither reservedSize nor digestAlgorithm are validated - the caller is responsible for reserving enough space and for using a supported digest algorithm.
|
|
PacketDataList
|
readDataList(String name)
Creates a non persistent PacketDataList from the contents of this file. The contents must support DataList conversion (currently .csv and .xls). If xls, this will execute formulas. This method also takes liberties with regard to column names. If it encounters any blank column name it assumes the first row is data and renames all the columns as col0 - colN. If xls, it will also attempt to find a matching tab by name and if that fails, it will return the first tab. Throws exception if invalid or unsupported file format.
|
|
Payload
|
readDataLists()
Creates a Payload of PacketDataList from the contents of this file. The contents must support DataList conversion (currently .csv and .xls). If xls, this will execute formulas. This method also takes liberties with regard to column names. If it encounters any blank column name it assumes the first row is data and renames all the columns as col0 - colN. Throws exception if invalid or unsupported file format.
|
|
String
|
readFile()
Reads all of the text-based file and returns the content as a string. Returns null if there is no content. Throws exception if this file is not a text-based file.
|
|
String
|
readLine()
Reads one line (of the presumably text file) and returns it, advancing the reader to the next line for subsequent reads. Returns null if this file is not text based or there are no more lines to read. Best practice-call closeReader when finished.
|
|
DataList
|
readText()
Returns a datalist of text contained in this PDF. Returns null if the PDF cannot be read.
|
|
File
|
removeSignature()
Removes the digital signature, if any.
|
|
|
resizeWidth(int maxWidth)
Transforms the size of the file (only works on images) by reducing the width to the specified with. If the width is already less than the specified width, this does nothing.
|
|
|
rotate(int degrees)
Rotates this image by an angle provided in degrees. Image rotated clockwise if angle is a positive number and counter-clockwise if angle is a negative number
|
|
|
setData(Data data)
Updates pdf form fields with provided data. Note - further changes to data object are not reflected on document fields
|
|
|
setFilename(String newFileName)
Sets the name of the file to the specified name.
|
|
File
|
sign()
Applies a digital signature to the file. Content must be well formed XML.
|
|
AudioFile
|
toAudioFile()
Returns AudioFile created from this File. Method returns null if current file cannot be represented as an audio.
|
|
Data
|
toData()
Returns the content of this file as a Data object with three properties: fileName, contentType, and base64. base64 will be a Base64 encoded string of the file contents.
|
|
PacketDataList
|
toDataList(String name)
Creates a non persistent PacketDataList from the contents of this file. The contents must support DataList conversion (currently .csv and .xls)
|
|
ExcelFile
|
toExcelFile()
Returns ExcelFile created from this File. Method returns null if current file cannot be represented as an excel file.
|
|
ImageFile
|
toImage()
Returns ImageFile created from this File. Method returns null if current file cannot be represented as an image. The file must already be a supported image content type to use this method. If you are trying convert a PDF to an image you should just get a specified page or use toTIFF to get a multi-page TIFF file.
|
|
PdfFile
|
toPdf(String filename)
Converts this file to PDF if possible. Call isPdfConversionSupported() to check if file can be converted to PDF. Returns PDF file or null if PDF conversion is not supported
|
|
PdfFile
|
toPdf(String filename, String password)
This method expects the document to already be a PDF. Call isPdfConversionSupported() to check if file can be converted to PDF. Returns PDF file or null if PDF conversion is not supported
|
|
String
|
toString()
Returns a description of this object.
|
|
UnknownFile
|
toUnknownFile(String ext)
Converts this file to an UnknownFile (used for testing purposes).
|
|
VCardFile
|
toVCardFile()
Returns VCard representation of this file. Returns invalid file if current file cannot be parsed as VCard
|
Method Detail
addPage(int destinationPage, PdfFile sourcePdf, int sourcePage)
Adds the page from the source PDF to this PDF at the specified location. Controlled by Max Export Size of activation key.
Parameters:
-
int
destinationPage
- Where in this PDF to add the new page (shift others if applicable), 1 based..
-
PdfFile
sourcePdf
- PDF containing the source page..
Required parameter.
-
int
sourcePage
- Page number in source pdf, 1 based..
Since:
02-17-2012
Data analyze()
Performs a top level analysis of the PDF and returns summary information.
Returns:
Data
Since:
07-23-2015
appendPdf(PdfFile sourcePdf)
Appends the source PDF to this PDF. Controlled by Max Export Size of activation key.
Parameters:
-
PdfFile
sourcePdf
- PDF containing the source page.
Required parameter.
Since:
02-17-2012
boolean applyExternalSignature(Payload signatureResult)
Assembles a CMS SignedData structure from the pieces gathered from GlobalSign DSS and embeds it, along with the timestamp token, into the placeholder reserved by prepareExternalSignature(), completing an AATL-trusted signature. Throws WorkflowException immediately if prepareExternalSignature() wasn't called first. Returns false - without throwing - if any of the five required values are missing or empty, or if the assembled signature and timestamp exceed the reserved placeholder size. Any other unexpected failure (decode error, internal fault) is caught and rethrown as WorkflowException. Whether this call succeeds, returns false, or throws, the prepared placeholder state is cleared - a failed attempt cannot be retried without calling prepareExternalSignature() again.
Parameters:
-
Payload
signatureResult
- Payload carrying five required values gathered fresh from GlobalSign DSS this signing cycle: values 'signature' (hex-encoded raw signed hash from /identity/{id}/sign/{digest} - not a complete CMS structure), 'timestamp' (base64-encoded RFC 3161 TimeStampToken from /timestamp/{digest}), 'signing_cert' (PEM leaf certificate from /identity), and 'ocsp_response' (base64-encoded DER OCSPResponse from /identity, for PAdES-LT); and a DataList named 'certificate_path' (or 'trustchain') containing the CA chain PEMs from /certificate_path or /trustchain..
Required parameter.
Returns:
boolean
Since:
07-22-2026
String calcMD5()
Returns an MD5 checksum of the contents of this file.
Returns:
String
Since:
11-23-2012
clip(int x, int y, int w, int h)
If file is an image type, clips the image
Parameters:
Since:
09-05-2008
closeReader()
Resets the capability to read lines to the beginning of the file.
Since:
08-13-2013
File copy()
Returns a copy of the file
Returns:
File
Since:
11-17-2011
ImageFile copy()
Returns a copy of the file
Returns:
ImageFile
Since:
11-17-2011
PdfFile copyCompatible()
Creates a new PdfFile with version 1.5 or greater, making it compatible for usage as a Document.
Returns:
PdfFile
Since:
06-23-2020
FileBuffer createFileBuffer()
Reads this compressed file and returns a FileBuffer. Throws exception if this not a supported type (zip and jar).
Returns:
FileBuffer
Since:
08-27-2013
boolean createPdfTamperSeal()
Creates a Digital Signature 'tamper seal' on this file. This should be called only once, when all data have been applied. Returns false if this method has already been applied to the file.
Returns:
boolean
Since:
06-23-2011
ImageFile createSprite(int spacing, int padding, float scale, boolean horizontal, boolean includePageNumbers)
Creates a sprite image for the PDF. Restricted by max upload of the activation key and by the cloud max pdf page count.
Parameters:
-
int
spacing
- Spacing in px between pages..
-
int
padding
- Padding in px around pages..
-
float
scale
- Scale should be between 0 and .20..
-
boolean
horizontal
- If true, sprite will be horizontal, else vertical.
-
boolean
includePageNumbers
- If true, page numbers will be added..
Returns:
ImageFile
Since:
09-21-2012
ImageFile createSprite(int spacing, int padding, int height, int width, boolean horizontal, boolean includePageNumbers)
Creates a sprite image for the PDF. Restricted by max upload of the activation key and by the cloud max pdf page count. Height and width will not exceed 30% of normal page size.
Parameters:
-
int
spacing
- Spacing in px between pages..
-
int
padding
- Padding in px around pages..
-
int
height
- Height of the individual image..
-
int
width
- Width of the individual image..
-
boolean
horizontal
- If true, sprite will be horizontal, else vertical.
-
boolean
includePageNumbers
- If true, page numbers will be added..
Returns:
ImageFile
Since:
11-18-2013
boolean decrypt(String password)
Sets password for pdf decryption. Call this method before any other modification method if pdf file is password protected. Returns false if decryption fails.
Parameters:
-
String
password
- user or owner password. Empty string or null is permitted.
Returns:
boolean
Since:
10-21-2011
File decrypt(String password, String filename)
Returns a new file. Assumes the content of this file is PGP encrypted.
Parameters:
-
String
password
Required parameter.
-
String
filename
Required parameter.
Returns:
File
Since:
03-17-2014
boolean deletePage(int pageNumber)
Deletes the specified page. Returns false if the page cannot be deleted.
Parameters:
Returns:
boolean
Since:
07-13-2011
File encrypt(String password)
Returns a new file with the content of this file PGP encrypted. The new file's filename will be existing filename+.txt
Parameters:
-
String
password
Required parameter.
Returns:
File
Since:
05-16-2011
File encrypt(String password, String filename)
Returns a new file with the content of this file PGP encrypted having the specified file name. Extensions allowed: pgp, gpg, txt, asc. Extension is required.
Parameters:
-
String
password
Required parameter.
-
String
filename
Required parameter.
Returns:
File
Since:
10-07-2016
String getContentType()
Returns the content type of this file
Returns:
String
Since:
02-03-2010
String getFailureMessage()
When isValid is false, contains failure message.
Returns:
String
Since:
04-01-2009
String getFileExtension()
Returns the file extension. 'Myfile.doc' returns 'doc'
Returns:
String
Since:
06-10-2010
int getFileLength()
Returns the size of the file in bytes.
Returns:
int
Since:
08-23-2018
int getFileSize()
Returns the size of the file in kilobytes.
Returns:
int
Since:
04-10-2007
String getFileType()
Returns the type of the file as specified by the upload tag or API. This may be null if the file was obtained by means other than an upload.
Returns:
String
Since:
04-10-2007
String getFilename()
Returns the name of the uploaded file (without the full path).
Returns:
String
Since:
11-07-2007
int getHeight()
Returns image height
Returns:
int
Since:
11-17-2011
Data getImageMetadata()
Returns metadata of this image file (not all of which might be present): longitude,latitude,date,camera,manufacturer,focalLength,fStop,exposureTime,isoSpeedRatings
shutterSpeedValueAPEX,shutterSpeedExposureTime,apertureValueAPEX,subjectDistance,dateTimeOriginal,orientation,height,width,p0-p12. p0-p12 contains pixel colors for 13 points on the image in hex.
Returns:
Data
Since:
01-26-2017
Payload getNativeLayer()
Obtains the native layer for this PDF from the underlying content. Changes to this layer are not persisted.
Returns:
Payload
Since:
04-26-2012
ImageFile getPage(String filename, int page, float scale, boolean grayscale)
Creates a PNG of the specified page.
Parameters:
-
String
filename
- file name.
Required parameter.
-
int
page
- Page number..
Required parameter.
-
float
scale
- image zoom factor. Value 1.0 means 100%. Max 3..
-
boolean
grayscale
- produce image in color (false) or gray scale (true).
Returns:
ImageFile
Since:
07-19-2011
int getPageCount()
Returns the number of pages in this PDF.
Returns:
int
Since:
07-19-2011
DataReader getReader()
Opens a data reader for this file. File type should be list compatible.
Returns:
DataReader
Since:
11-20-2019
DataList getSpriteMap(String name)
Returns a DataList containing sprite coordinate information that can be used to create an HTML image map for the sprite. Call createSprite before calling this method.
Parameters:
-
String
name
Required parameter.
Returns:
DataList
DataList Name: map
DataList Fields: page, coords, left, top, height, width
Since:
11-13-2012
TiffBuilder getTiffBuilder()
Returns a new TiffBuilder for this PdfFile. Throws exception if the content is invalid.
Returns:
TiffBuilder
Since:
01-28-2013
int getWidth()
Returns image width
Returns:
int
Since:
11-17-2011
XMLReader getXMLReader(boolean removeNamespaces)
Returns a ServicePayload for processing XML-based files. Returns null if the file is not XML.
Parameters:
Returns:
XMLReader
Since:
04-11-2023
hidePdfMenubar()
Adds viewer setting to not display its menu bar
Since:
06-23-2011
hidePdfToolbar()
Adds viewer setting to not display its toolbar
Since:
06-23-2011
hidePdfUI()
Adds viewer setting to not display its UI
Since:
06-23-2011
boolean isAdHocConversionSupported()
Returns true if the content supports immediate conversion to adhoc. See Packet.createAdHocDocument(File,...)
Returns:
boolean
Since:
11-09-2009
boolean isCompatible()
Returns true if this PDF can be converted to a Document.
Returns:
boolean
Since:
07-23-2015
boolean isCorrectType()
Returns true if the type of the file is within the specified restriction.
Returns:
boolean
Since:
04-10-2007
boolean isDataListSupported()
Returns true if this file content can be used as a DataList. See Attachment.toDataList
Returns:
boolean
Since:
02-03-2010
boolean isEncrypted()
Checks if this pdf file is password protected
Returns:
boolean
Since:
10-21-2011
boolean isMacro()
Returns true if the content of the file contains macro.
Returns:
boolean
Since:
02-23-2010
boolean isPdfConversionSupported()
Returns true if the content supports conversion to PDF.
Returns:
boolean
Since:
03-10-2008
boolean isPdfValid()
Returns true if the content of the file is valid PDF. This will return false for encrypted PDFs or any non PDF files.
Returns:
boolean
Since:
05-20-2025
boolean isSealed()
Returns true if this PDF has been tamper sealed.
Returns:
boolean
Since:
02-17-2012
boolean isSizeExceeded()
Returns true if the size of the file exceeds the specified restriction.
Returns:
boolean
Since:
04-10-2007
boolean isValid()
Returns true if the content of the file is valid.
Returns:
boolean
Since:
04-10-2007
boolean isVirus()
Returns true if the content of the file contains a virus.
Returns:
boolean
Since:
04-10-2007
File pgpDecrypt(File keyFile, String password, String filename)
Returns a new file with the content of this PGP encrypted file decrypted using the provided private key. The content type is guessed from the file name extension
Parameters:
-
File
keyFile
Required parameter.
-
String
password
Required parameter.
-
String
filename
Required parameter.
Returns:
File
Since:
08-03-2016
File pgpEncrypt(File keyFile)
Returns a new file with the content of this file PGP encrypted using the provided public key. The new file's filename will be existing filename+.txt
Parameters:
-
File
keyFile
Required parameter.
Returns:
File
Since:
08-03-2016
Data prepareExternalSignature(int reservedSize, String digestAlgorithm)
Reserves a placeholder of reservedSize bytes in the PDF's signature dictionary for an externally-generated (e.g. third-party AATL) signature, and returns a 'digest' entry containing the hex-encoded digest of the byte range outside that placeholder. Retains placeholder state on this instance until applyExternalSignature() is called. Neither reservedSize nor digestAlgorithm are validated - the caller is responsible for reserving enough space and for using a supported digest algorithm.
Parameters:
-
int
reservedSize
- Number of bytes to reserve in the signature dictionary for the combined signature and timestamp token. Typically 15000 or greater..
Required parameter.
-
String
digestAlgorithm
- Digest algorithm to use when hashing the byte range outside the reserved placeholder, e.g. SHA-256..
Required parameter.
Returns:
Data
Since:
07-22-2026
PacketDataList readDataList(String name)
Creates a non persistent PacketDataList from the contents of this file. The contents must support DataList conversion (currently .csv and .xls). If xls, this will execute formulas. This method also takes liberties with regard to column names. If it encounters any blank column name it assumes the first row is data and renames all the columns as col0 - colN. If xls, it will also attempt to find a matching tab by name and if that fails, it will return the first tab. Throws exception if invalid or unsupported file format.
Parameters:
-
String
name
Required parameter.
Returns:
PacketDataList
Since:
06-03-2020
Payload readDataLists()
Creates a Payload of PacketDataList from the contents of this file. The contents must support DataList conversion (currently .csv and .xls). If xls, this will execute formulas. This method also takes liberties with regard to column names. If it encounters any blank column name it assumes the first row is data and renames all the columns as col0 - colN. Throws exception if invalid or unsupported file format.
Returns:
Payload
Since:
05-11-2021
String readFile()
Reads all of the text-based file and returns the content as a string. Returns null if there is no content. Throws exception if this file is not a text-based file.
Returns:
String
Since:
01-20-2015
String readLine()
Reads one line (of the presumably text file) and returns it, advancing the reader to the next line for subsequent reads. Returns null if this file is not text based or there are no more lines to read. Best practice-call closeReader when finished.
Returns:
String
Since:
08-13-2013
DataList readText()
Returns a datalist of text contained in this PDF. Returns null if the PDF cannot be read.
Returns:
DataList
DataList Name: textList
DataList Fields: text, left, top, height, width, page
Since:
02-16-2024
File removeSignature()
Removes the digital signature, if any.
Returns:
File
Since:
02-26-2016
resizeWidth(int maxWidth)
Transforms the size of the file (only works on images) by reducing the width to the specified with. If the width is already less than the specified width, this does nothing.
Parameters:
Since:
04-10-2007
rotate(int degrees)
Rotates this image by an angle provided in degrees. Image rotated clockwise if angle is a positive number and counter-clockwise if angle is a negative number
Parameters:
-
int
degrees
- rotation angle in degrees.
Since:
10-19-2011
setData(Data data)
Updates pdf form fields with provided data. Note - further changes to data object are not reflected on document fields
Parameters:
-
Data
data
- data object.
Required parameter.
Since:
06-23-2011
setFilename(String newFileName)
Sets the name of the file to the specified name.
Parameters:
-
String
newFileName
- New file name including extension, which must match existing extension.
Required parameter.
Since:
06-04-2024
File sign()
Applies a digital signature to the file. Content must be well formed XML.
Returns:
File
Since:
02-26-2016
AudioFile toAudioFile()
Returns AudioFile created from this File. Method returns null if current file cannot be represented as an audio.
Returns:
AudioFile
Since:
03-09-2018
Data toData()
Returns the content of this file as a Data object with three properties: fileName, contentType, and base64. base64 will be a Base64 encoded string of the file contents.
Returns:
Data
Since:
05-16-2011
PacketDataList toDataList(String name)
Creates a non persistent PacketDataList from the contents of this file. The contents must support DataList conversion (currently .csv and .xls)
Parameters:
Returns:
PacketDataList
Since:
05-15-2010
ExcelFile toExcelFile()
Returns ExcelFile created from this File. Method returns null if current file cannot be represented as an excel file.
Returns:
ExcelFile
Since:
01-17-2022
ImageFile toImage()
Returns ImageFile created from this File. Method returns null if current file cannot be represented as an image. The file must already be a supported image content type to use this method. If you are trying convert a PDF to an image you should just get a specified page or use toTIFF to get a multi-page TIFF file.
Returns:
ImageFile
Since:
10-19-2011
PdfFile toPdf(String filename)
Converts this file to PDF if possible. Call isPdfConversionSupported() to check if file can be converted to PDF. Returns PDF file or null if PDF conversion is not supported
Parameters:
-
String
filename
- name of converted file.
Required parameter.
Returns:
PdfFile
Since:
07-04-2011
PdfFile toPdf(String filename, String password)
This method expects the document to already be a PDF. Call isPdfConversionSupported() to check if file can be converted to PDF. Returns PDF file or null if PDF conversion is not supported
Parameters:
-
String
filename
- name of converted file.
Required parameter.
-
String
password
- password if any.
Required parameter.
Returns:
PdfFile
Since:
10-05-2017
String toString()
Returns a description of this object.
Returns:
String
Since:
06-14-2007
UnknownFile toUnknownFile(String ext)
Converts this file to an UnknownFile (used for testing purposes).
Parameters:
-
String
ext
Required parameter.
Returns:
UnknownFile
Since:
08-23-2018
VCardFile toVCardFile()
Returns VCard representation of this file. Returns invalid file if current file cannot be parsed as VCard
Returns:
VCardFile
Since:
12-12-2011