public final class PdfFormat extends DocumentFormat<PdfMetadata,PdfMetadataProperty,DocumentInfo> implements IXmp, IInspectable<PdfInspectionResult,PdfInspectionOptions>, IProtectableFormat, ISignedFormat
Represents a PDF document.
Constructor and Description |
---|
PdfFormat(InputStream input)
Initializes a new instance of the
PdfFormat class. |
PdfFormat(InputStream input,
LoadOptions loadOptions)
Initializes a new instance of the
PdfFormat class. |
PdfFormat(String fileName)
Initializes a new instance of the
PdfFormat class. |
PdfFormat(String fileName,
LoadOptions loadOptions)
Initializes a new instance of the
PdfFormat class. |
Modifier and Type | Method and Description |
---|---|
void |
cleanMetadata()
Removes metadata found in the document.
|
protected void |
dispose(boolean disposing)
Releases unmanaged and optionally managed resources.
|
PdfMetadata |
getDocumentProperties()
Gets the document properties in
PdfFormat . |
DublinCoreMetadata |
getDublinCore()
Retrieves the Dublin Core metadata.
|
int |
getFileType()
Gets file type.
|
int |
getType()
Gets the type of the loaded file.
|
String |
getVersion()
Gets the PDF version.
|
XmpPacketWrapper |
getXmpData()
Returns the XMP packet.
|
XmpProperties |
getXmpProperties()
Returns all XMP properties presented in a specific format.
|
XmpEditableCollection |
getXmpValues()
Gets a collection containing the XMP metadata properties.
|
boolean |
hasDigitalSignatures()
Gets a value indicating whether the document contains a
DigitalSignature . |
boolean |
hasXmp()
Gets a value indicating whether the file contains XMP metadata.
|
PdfInspectionResult |
inspectDocument()
Inspects document and return hidden data such as attachments, annotations etc.
|
boolean |
isProtected()
Gets a value indicating whether the document is encrypted and requires a password to open.
|
void |
removeHiddenData(PdfInspectionOptions options)
Removes the hidden data.
|
void |
removeXmpData()
Removes the XMP metadata.
|
boolean |
setXmpData(XmpPacketWrapper package_)
Updates the XMP packet.
|
clearBuiltInProperties, clearCustomProperties, extractDocumentProperties, getDocumentInfo, getThumbnail, readDocumentPropertyByKey, readPropertyByName, readThumbnail, setProperties
close, dispose, getMetadata, getMIMEType, readByMetadataKey, save, save, save
public PdfFormat(String fileName)
Initializes a new instance of the PdfFormat
class.
fileName
- A string that contains the full name of the file from which to create a PdfFormat
instance.public PdfFormat(String fileName, LoadOptions loadOptions)
Initializes a new instance of the PdfFormat
class.
fileName
- A string that contains the full name of the file from which to create a PdfFormat
instance.loadOptions
- Additional options to use when loading a document.public PdfFormat(InputStream input)
Initializes a new instance of the PdfFormat
class.
input
- A stream that contains the data for this PdfFormat
.public PdfFormat(InputStream input, LoadOptions loadOptions)
Initializes a new instance of the PdfFormat
class.
input
- A stream that contains the data for this PdfFormat
.loadOptions
- Additional options to use when loading a document.public int getType()
Gets the type of the loaded file.
getType
in class FormatBase
public final String getVersion()
Gets the PDF version.
public PdfMetadata getDocumentProperties()
Gets the document properties in PdfFormat
.
getDocumentProperties
in class DocumentFormat<PdfMetadata,PdfMetadataProperty,DocumentInfo>
public final boolean hasDigitalSignatures()
Gets a value indicating whether the document contains a DigitalSignature
.
hasDigitalSignatures
in interface ISignedFormat
true
if document has digital signatures; otherwise, false
.GroupDocsException
- Could not read digital signatures.
Value:
true
if the document has digital signatures; otherwise, false
.public int getFileType()
Gets file type.
getFileType
in class DocumentFormat<PdfMetadata,PdfMetadataProperty,DocumentInfo>
public final boolean isProtected()
Gets a value indicating whether the document is encrypted and requires a password to open.
isProtected
in interface IProtectableFormat
true
if PDF is protected; otherwise, false
.public final boolean hasXmp()
Gets a value indicating whether the file contains XMP metadata.
public final XmpEditableCollection getXmpValues()
Gets a collection containing the XMP metadata properties. Provides access to all XMP properties in edit mode.
getXmpValues
in interface IXmp
public final XmpPacketWrapper getXmpData()
Returns the XMP packet.
getXmpData
in interface IXmp
XmpPacketWrapper
if the file contains an XMP metadata package; otherwise, null.public final XmpProperties getXmpProperties()
Returns all XMP properties presented in a specific format.
getXmpProperties
in interface IXmp
XmpProperties
if the file contains an XMP metadata package; otherwise, null.public final boolean setXmpData(XmpPacketWrapper package_)
Updates the XMP packet.
setXmpData
in interface IXmp
package
- An XMP packet wrapper.true
if the XMP package is successfully updated; otherwise, false.public final void removeXmpData()
Removes the XMP metadata.
removeXmpData
in interface IXmp
public final DublinCoreMetadata getDublinCore()
Retrieves the Dublin Core metadata.
getDublinCore
in interface IDublinCore
DublinCoreMetadata
if the appropriate package is found; otherwise, null.public void cleanMetadata()
Removes metadata found in the document.
cleanMetadata
in class FormatBase
public final PdfInspectionResult inspectDocument()
Inspects document and return hidden data such as attachments, annotations etc.
inspectDocument
in interface IInspectable<PdfInspectionResult,PdfInspectionOptions>
PdfInspectionResult
.
public final void removeHiddenData(PdfInspectionOptions options)
Removes the hidden data.
removeHiddenData
in interface IInspectable<PdfInspectionResult,PdfInspectionOptions>
options
- The options.protected void dispose(boolean disposing)
Releases unmanaged and optionally managed resources.
dispose
in class FormatBase
disposing
- true
to release both managed and unmanaged resources;
false
to release only unmanaged resources.Copyright © 2019. All rights reserved.