PdfFileInfo

Inheritance: java.lang.Object, com.aspose.pdf.facades.IVentureLicenseTarget, com.aspose.pdf.facades.Facade, com.aspose.pdf.facades.SaveableFacade

public final class PdfFileInfo extends SaveableFacade

Represents a class for accessing meta information of PDF document.

Constructors

ConstructorDescription
PdfFileInfo()Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class with default values.
PdfFileInfo(InputStream inputStream)Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.
PdfFileInfo(InputStream inputStream, String password)Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.
PdfFileInfo(String inputFile)Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.
PdfFileInfo(String inputFile, String password)Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.
PdfFileInfo(IDocument document)Initializes new PdfFileInfo object on base of the document .

Methods

MethodDescription
bindPdf(String srcFile, String password)Initializes the facade.
bindPdf(IDocument srcDoc)Initializes the facade.
getAuthor()Gets the Author information of PDF document.
setAuthor(String value)Sets the Author information of PDF document.
isEncrypted()Checks whether the PDF document is encrypted.
isPdfFile()Checks whether the source input is a valid PDF file.
getUseStrictValidation()Uses strict validation rules via using IsPdfFile (#isPdfFile#isPdfFile) property.
setUseStrictValidation(boolean value)Uses strict validation rules via using IsPdfFile (#isPdfFile#isPdfFile) property.
getCreationDate()Gets the CreationDate information of PDF document.
setCreationDate(String value)Sets the CreationDate information of PDF document.
getCreator()Gets the Creator information of PDF document.
setCreator(String value)Sets the Creator information of PDF document.
hasCollection()Returns true if the current input file is a ‘Portfolio’ file containing collection of PDF files in it.
getHeader()Gets the customized information of PDF document.
setHeader(Map<String,String> value)Sets the customized information of PDF document.
getInputFile()Gets the input file.
setInputFile(String value)Sets the input file.
getInputStream()Gets the input stream.
setInputStream(InputStream value)Sets the input stream.
getKeywords()Gets the Keywords information of PDF document.
setKeywords(String value)Sets the Keywords information of PDF document.
getModDate()Gets the ModDate date information of PDF document.
setModDate(String value)Sets the ModDate date information of PDF document.
getNumberOfPages()Gets the number of document pages.
getProducer()Gets the Producer information of PDF document.
getSubject()Gets the Subject information of PDF document.
setSubject(String value)Sets the Subject information of PDF document.
getTitle()Gets the Title information of PDF document.
setTitle(String value)Sets the Title information of PDF document.
clearInfo()Clears all meta information of PDF document.
getDocumentPrivilege()Gets the PDF document privilege settings.
getMetaInfo(String name)Gets customized information of PDF document with property name.
getPageHeight(int pageNum)Gets the height of the specified page.
getPageRotation(int pageNum)Gets the rotation of the specified page.
getPageWidth(int pageNum)Gets the width of the specified page.
getPageXOffset(int pageNum)Gets the horizontal offset of the specified page display area.
getPageYOffset(int pageNum)Gets the vertical offset of the specified page display area.
getPdfVersion()Gets the version info of PDF document.
saveNewInfo(OutputStream outputStream)Save updated PDF document into specified stream.
saveNewInfo(String outputFile)Save updated PDF document into specified file.
save(OutputStream destStream)Saves the PDF document to the specified file.
setMetaInfo(String name, String value)Sets customized information of PDF document.
saveNewInfoWithXmp(String outputFileName)Changes the properties specified explicitly by setting file information, other properties remain.
getPasswordType()Returns the type of password which was passed for creating PdfFileInfo instance.
hasOpenPassword()Returns true if password is needed to open password protected pdf document.
hasEditPassword()Returns true if password is needed to modify permissions or document security property.
close()Closes all resources used by this document.
dispose()Closes all resources used by this instance.

PdfFileInfo()

public PdfFileInfo()

Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class with default values.

PdfFileInfo(InputStream inputStream)

public PdfFileInfo(InputStream inputStream)

Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamStream where input file is placed.

PdfFileInfo(InputStream inputStream, String password)

public PdfFileInfo(InputStream inputStream, String password)

Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamStream where input file is placed.
passwordjava.lang.StringPassword for access to file.

PdfFileInfo(String inputFile)

public PdfFileInfo(String inputFile)

Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

Parameters:

ParameterTypeDescription
inputFilejava.lang.StringName of file containing input file.

PdfFileInfo(String inputFile, String password)

public PdfFileInfo(String inputFile, String password)

Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

Parameters:

ParameterTypeDescription
inputFilejava.lang.StringName of file containing input file.
passwordjava.lang.StringPassword for access to file.

PdfFileInfo(IDocument document)

public PdfFileInfo(IDocument document)

Initializes new PdfFileInfo object on base of the document .

Parameters:

ParameterTypeDescription
documentIDocumentPdf document.

bindPdf(String srcFile, String password)

public void bindPdf(String srcFile, String password)

Initializes the facade.

Parameters:

ParameterTypeDescription
srcFilejava.lang.StringThe PDF file.
passwordjava.lang.StringThe password of the PDF document.

bindPdf(IDocument srcDoc)

public void bindPdf(IDocument srcDoc)

Initializes the facade.

Parameters:

ParameterTypeDescription
srcDocIDocumentThe Document object.

getAuthor()

public String getAuthor()

Gets the Author information of PDF document.

Returns: java.lang.String - String value

setAuthor(String value)

public void setAuthor(String value)

Sets the Author information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

isEncrypted()

public boolean isEncrypted()

Checks whether the PDF document is encrypted.

Returns: boolean - boolean value

isPdfFile()

public boolean isPdfFile()

Checks whether the source input is a valid PDF file.

Returns: boolean - boolean value

getUseStrictValidation()

public final boolean getUseStrictValidation()

Uses strict validation rules via using IsPdfFile (#isPdfFile#isPdfFile) property.

Returns: boolean - boolean value

setUseStrictValidation(boolean value)

public final void setUseStrictValidation(boolean value)

Uses strict validation rules via using IsPdfFile (#isPdfFile#isPdfFile) property.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getCreationDate()

public String getCreationDate()

Gets the CreationDate information of PDF document.

Returns: java.lang.String - String value

setCreationDate(String value)

public void setCreationDate(String value)

Sets the CreationDate information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getCreator()

public String getCreator()

Gets the Creator information of PDF document.

Returns: java.lang.String - String value

setCreator(String value)

public void setCreator(String value)

Sets the Creator information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

hasCollection()

public boolean hasCollection()

Returns true if the current input file is a ‘Portfolio’ file containing collection of PDF files in it.

Returns: boolean - boolean value

getHeader()

public Map<String,String> getHeader()

Gets the customized information of PDF document.

Returns: java.util.Map<java.lang.String,java.lang.String> - Map object

setHeader(Map<String,String> value)

public void setHeader(Map<String,String> value)

Sets the customized information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.util.Map<java.lang.String,java.lang.String>Map object

getInputFile()

public String getInputFile()

Gets the input file.

Returns: java.lang.String - String value

setInputFile(String value)

public void setInputFile(String value)

Sets the input file.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getInputStream()

public InputStream getInputStream()

Gets the input stream.

Returns: java.io.InputStream - InputStream object

setInputStream(InputStream value)

public void setInputStream(InputStream value)

Sets the input stream.

Parameters:

ParameterTypeDescription
valuejava.io.InputStreamInputStream object

getKeywords()

public String getKeywords()

Gets the Keywords information of PDF document.

Returns: java.lang.String - String value

setKeywords(String value)

public void setKeywords(String value)

Sets the Keywords information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getModDate()

public String getModDate()

Gets the ModDate date information of PDF document.

Returns: java.lang.String - String value

setModDate(String value)

public void setModDate(String value)

Sets the ModDate date information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getNumberOfPages()

public int getNumberOfPages()

Gets the number of document pages.

Returns: int - int value

getProducer()

public String getProducer()

Gets the Producer information of PDF document.

Returns: java.lang.String - String value

getSubject()

public String getSubject()

Gets the Subject information of PDF document.

Returns: java.lang.String - String value

setSubject(String value)

public void setSubject(String value)

Sets the Subject information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getTitle()

public String getTitle()

Gets the Title information of PDF document.

Returns: java.lang.String - String value

setTitle(String value)

public void setTitle(String value)

Sets the Title information of PDF document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

clearInfo()

public void clearInfo()

Clears all meta information of PDF document.

getDocumentPrivilege()

public DocumentPrivilege getDocumentPrivilege()

Gets the PDF document privilege settings.

Returns: DocumentPrivilege - The PDF document privilege settings.

getMetaInfo(String name)

public String getMetaInfo(String name)

Gets customized information of PDF document with property name. If there is no property match the name it will return a blank string.

Parameters:

ParameterTypeDescription
namejava.lang.StringCustom meta property key.

Returns: java.lang.String - Custom meta property value.

getPageHeight(int pageNum)

public float getPageHeight(int pageNum)

Gets the height of the specified page.

Parameters:

ParameterTypeDescription
pageNumintPage number.

Returns: float - The height of the page.

getPageRotation(int pageNum)

public int getPageRotation(int pageNum)

Gets the rotation of the specified page.

Parameters:

ParameterTypeDescription
pageNumintPage number.

Returns: int - The rotation of the page. The value may be 0,90,180,270.

getPageWidth(int pageNum)

public float getPageWidth(int pageNum)

Gets the width of the specified page.

Parameters:

ParameterTypeDescription
pageNumintPage number.

Returns: float - The width of the page.

getPageXOffset(int pageNum)

public float getPageXOffset(int pageNum)

Gets the horizontal offset of the specified page display area.

Parameters:

ParameterTypeDescription
pageNumintPage number.

Returns: float - The horizontal offset from the left side of the page.

getPageYOffset(int pageNum)

public float getPageYOffset(int pageNum)

Gets the vertical offset of the specified page display area.

Parameters:

ParameterTypeDescription
pageNumintPage number.

Returns: float - The vertical offset of the page display area.

getPdfVersion()

public String getPdfVersion()

Gets the version info of PDF document.

Returns: java.lang.String - The version string.

saveNewInfo(OutputStream outputStream)

public boolean saveNewInfo(OutputStream outputStream)

Save updated PDF document into specified stream.

Parameters:

ParameterTypeDescription
outputStreamjava.io.OutputStreamOutput stream.

Returns: boolean - True if success otherwise is false.

saveNewInfo(String outputFile)

public boolean saveNewInfo(String outputFile)

Save updated PDF document into specified file.

Parameters:

ParameterTypeDescription
outputFilejava.lang.StringOutput file.

Returns: boolean - True if success otherwise is false.

save(OutputStream destStream)

public void save(OutputStream destStream)

Saves the PDF document to the specified file.

Parameters:

ParameterTypeDescription
destStreamjava.io.OutputStreamThe destination stream.

setMetaInfo(String name, String value)

public void setMetaInfo(String name, String value)

Sets customized information of PDF document.

Parameters:

ParameterTypeDescription
namejava.lang.StringCustom meta property key.
valuejava.lang.StringCustom meta property value.

saveNewInfoWithXmp(String outputFileName)

public boolean saveNewInfoWithXmp(String outputFileName)

Changes the properties specified explicitly by setting file information, other properties remain.

Parameters:

ParameterTypeDescription
outputFileNamejava.lang.StringOutput file.

Returns: boolean - True for success, or false.

getPasswordType()

public int getPasswordType()

Returns the type of password which was passed for creating PdfFileInfo instance. See possible values in PasswordType . Pay attention that pdf document can be opened using both user (or open) password and owner (or permissions, edit) password.

Returns: int - PasswordType element

hasOpenPassword()

public boolean hasOpenPassword()

Returns true if password is needed to open password protected pdf document.

Returns: boolean - boolean value

hasEditPassword()

public boolean hasEditPassword()

Returns true if password is needed to modify permissions or document security property. Pay attention that this property can be read only if valid password was provided in PdfFileInfo constructor. In case PasswordType is Inaccessible (means that invalid password was provided) reading this property will fail with InvalidPasswordException .

Returns: boolean - boolean value

close()

public void close()

Closes all resources used by this document.

dispose()

public void dispose()

Closes all resources used by this instance.

This method is obsolete, use close() instead.