PdfFileInfo
Overview
PdfFileInfo is a class in Aspose.Pdf FOSS for Java.
Inherits from: Closeable.
Provides read-only access to PDF document metadata and properties such as title, author, page count, and encryption status.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
document | Document | Read | Returns the bound document, or {@code null}. |
title | String | Read | Returns the document title. |
author | String | Read | Returns the document author. |
subject | String | Read | Returns the document subject. |
keywords | String | Read | Returns the document keywords. |
creator | String | Read | Returns the document creator application. |
producer | String | Read | Returns the PDF producer. |
creationDate | Date | Read | Returns the document creation date. |
modDate | Date | Read | Returns the document modification date. |
encrypted | boolean | Read | Returns whether the document is encrypted. |
pdfFile | boolean | Read | Returns whether the bound file is a valid PDF. |
passwordType | PasswordType | Read | Returns the role of the password used to open the document. |
numberOfPages | int | Read | Returns the total number of pages. |
documentPrivilege | DocumentPrivilege | Read | Returns document permissions as a facade-compatible privilege object. |
Methods
| Signature | Description |
|---|---|
PdfFileInfo() | Creates a new empty {@code PdfFileInfo} instance. |
PdfFileInfo(inputFile: String) | Creates a {@code PdfFileInfo} by opening the specified PDF file. |
PdfFileInfo(inputFile: String, password: String) | Creates a {@code PdfFileInfo} by opening the specified encrypted PDF file |
| using the provided password. | |
PdfFileInfo(inputFile: String, password: String, customHandler: ICustomSecurityHandler) | Creates a {@code PdfFileInfo} for an encrypted PDF using a custom security handler. |
PdfFileInfo(stream: InputStream) | Creates a {@code PdfFileInfo} by reading from the specified input stream. |
PdfFileInfo(stream: InputStream, password: String) | Creates a {@code PdfFileInfo} by reading from the specified encrypted input |
| stream using the provided password. | |
PdfFileInfo(stream: InputStream, password: String, customHandler: ICustomSecurityHandler) | Creates a {@code PdfFileInfo} by reading an encrypted input stream using |
| a custom security handler. | |
PdfFileInfo(document: Document) | Creates a {@code PdfFileInfo} bound to an already-loaded document. |
getDocument() → Document | Returns the bound document, or {@code null}. |
bindPdf(document: Document) → boolean | Binds an already opened document instance to this info reader. |
bindPdf(inputFile: String) → boolean | Binds a PDF file to this info reader. |
bindPdf(inputFile: String, password: String) → boolean | Binds an encrypted PDF file to this info reader using the provided |
| password. | |
bindPdf(inputStream: InputStream) → boolean | Binds a PDF from an input stream. |
bindPdf(inputStream: InputStream, password: String) → boolean | Binds an encrypted PDF from an input stream using the provided password. |
bindPdf(inputFile: String, password: String, customHandler: ICustomSecurityHandler) → boolean | Binds an encrypted PDF file using a custom security handler. |
bindPdf(inputStream: InputStream, password: String, customHandler: ICustomSecurityHandler) → boolean | Binds an encrypted PDF stream using a custom security handler. |
getTitle() → String | Returns the document title. |
getAuthor() → String | Returns the document author. |
getSubject() → String | Returns the document subject. |
getKeywords() → String | Returns the document keywords. |
getCreator() → String | Returns the document creator application. |
getProducer() → String | Returns the PDF producer. |
getCreationDate() → Date | Returns the document creation date. |
getModDate() → Date | Returns the document modification date. |
isEncrypted() → boolean | Returns whether the document is encrypted. |
isPdfFile() → boolean | Returns whether the bound file is a valid PDF. |
hasOpenPassword() → boolean | Returns whether the encrypted document has an open password entry. |
hasEditPassword() → boolean | Returns whether the encrypted document has an edit password entry. |
getPasswordType() → PasswordType | Returns the role of the password used to open the document. |
getNumberOfPages() → int | Returns the total number of pages. |
getPageWidth(pageNumber: int) → double | Returns the page width in points (1/72 inch) for the given 1-based page |
| number, taken from the page’s MediaBox. | |
getPageHeight(pageNumber: int) → double | Returns the page height in points (1/72 inch) for the given 1-based page |
| number, taken from the page’s MediaBox. | |
getDocumentPrivilege() → DocumentPrivilege | Returns document permissions as a facade-compatible privilege object. |
setMetaInfo(name: String, value: String) | Adds (or overwrites) a custom entry in the document’s /Info dictionary. |
saveNewInfo(outputFile: String) → boolean | Saves the bound document — together with any {@link #setMetaInfo} edits — |
| to {@code outputFile}. | |
saveNewInfo(outputStream: OutputStream) → boolean | Stream variant of {@link #saveNewInfo(String)}. |
clearInfo() | Clears the standard document metadata entries from the bound document. |
close() | Closes this info reader and releases the bound document. |