PdfFileInfo
Overview
PdfFileInfo is a class in Aspose.PDF FOSS for .NET.
Inherits from: IDisposable.
Facade for accessing PDF document metadata and properties.
This class provides 34 methods for working with PdfFileInfo objects in .NET programs.
Available methods include: BindPdf, ClearInfo, Close, Dispose, GetDocumentInfo, GetDocumentPrivilege, GetMetaInfo, GetPageHeight, GetPageRotation, GetPageWidth, GetPageXOffset, GetPageYOffset, and 8 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: Author, CreationDate, CreationDateValue, Creator, Document, HasCollection, and 26 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
Document | Document? | Read | The bound Document. |
InputFile | string? | Read/Write | Path of the source PDF. |
HasOpenPassword | bool | Read | Whether the PDF requires a user/open password to open. |
HasEditPassword | bool | Read | Whether the PDF has an owner/edit password (i.e. |
PasswordType | PasswordType | Read | Which kind of password (if any) authenticated the bound PDF. |
Title | string? | Read/Write | The document title. |
Author | string? | Read/Write | The document author. |
Subject | string? | Read/Write | The document subject. |
Keywords | string? | Read/Write | The document keywords. |
Creator | string? | Read/Write | The creator application. |
Producer | string? | Read | The producer application that created the PDF. |
Header | Dictionary<string, string> | Read/Write | Custom metadata entries from the underlying /Info dictionary, keyed by name. |
CreationDate | string | Read/Write | The creation date in PDF native format (D:YYYYMMDDHHmmSSOHH’mm’), or empty when absent. |
CreationDateValue | DateTime | Read/Write | Raw DateTime view of CreationDate (convenience accessor). |
ModDate | string | Read/Write | The modification date in PDF native format (D:YYYYMMDDHHmmSSOHH’mm’), or empty when absent. |
ModDateValue | DateTime | Read/Write | Raw DateTime view of ModDate (convenience accessor). |
NumberOfPages | int | Read | Number of pages. |
PdfVersion | string? | Read | The PDF version string (e.g., “1.4”, “1.7”). |
IsEncrypted | bool | Read | Whether the document is encrypted. |
HasForm | bool | Read | Whether the document has a form. |
HasOutlines | bool | Read | Whether the document has bookmarks. |
HasMetadata | bool | Read | Whether the document has XMP metadata. |
HasEmbeddedFiles | bool | Read | Whether the document has embedded files. |
HasPageLabels | bool | Read | Whether the document has page labels. |
HasLayers | bool | Read | Whether the document has layers (optional content). |
HasCollection | bool | Read | Whether the document is a PDF Portfolio (has a /Collection entry in the catalog). |
IsTagged | bool | Read | Whether the document is tagged. |
PageLayout | string? | Read | The page layout mode (e.g., “SinglePage”, “TwoColumnLeft”). |
PageMode | string? | Read | The page mode (e.g., “UseOutlines”, “FullScreen”). |
IsPdfFile | bool | Read | Whether the bound document is a valid PDF file (instance property). |
InputStream | Stream? | Read/Write | Source-PDF stream. |
UseStrictValidation | bool | Read/Write | When true, the parser applies strict PDF validation rules. |
Methods
| Signature | Description |
|---|---|
PdfFileInfo() | Create an empty PdfFileInfo instance. |
PdfFileInfo(document: Document) | Create a PdfFileInfo instance wrapping an existing Document. |
PdfFileInfo(input: byte[]) | Create a PdfFileInfo instance from PDF bytes. |
PdfFileInfo(input: byte[], password: string) | Create a PdfFileInfo instance from PDF bytes with a password. |
PdfFileInfo(inputFile: string) | Create a PdfFileInfo instance from a file path. |
PdfFileInfo(inputFile: string, password: string) | Create a PdfFileInfo instance from a file path with a password. |
PdfFileInfo(inputStream: Stream) | Create a PdfFileInfo instance from a stream. |
PdfFileInfo(inputStream: Stream, password: string) | Open from a stream with a password. |
PdfFileInfo(inputStream: Stream, password: string, customSecurityHandler: Aspose.Pdf.Security.ICustomSecurityHandler) | Open from a stream with a password and a custom security handler. |
PdfFileInfo(inputFile: string, password: string, customSecurityHandler: Aspose.Pdf.Security.ICustomSecurityHandler) | Open from a file path with a password and a custom security handler. |
SaveNewInfo() | Save the modified info to a new PDF file. |
SaveNewInfoWithXmp() | Save the modified info to a new PDF file, synchronizing Info dict entries to XMP metadata. |
SaveNewInfoWithXmp(outputFileName: string) | Save the modified info to a file, synchronizing Info dict entries to XMP metadata. |
SetMetaInfo(name: string, value: string) | Set a custom metadata property in the document info dictionary. |
GetMetaInfo(name: string) | Get a custom metadata property from the document info dictionary. |
GetPdfVersion() | Method-form alias of PdfVersion. |
GetPageWidth(pageNum: int) | Get the width of a specific page in points (1-based page number). |
GetPageHeight(pageNum: int) | Get the height of a specific page in points (1-based page number). |
GetPageRotation(pageNum: int) | Get the rotation of a specific page (0, 90, 180, 270). |
GetPageXOffset(pageNum: int) | X coordinate of the page’s origin within the page boundary. |
GetPageYOffset(pageNum: int) | Y coordinate of the page’s origin within the page boundary. |
GetDocumentInfo() | Get all document metadata as a dictionary. |
IsValidPdfBytes(data: byte[]) | Check if the given bytes represent a valid PDF file. |
IsValidPdfStream(stream: Stream) | Check if the given stream represents a valid PDF file. |
GetDocumentPrivilege() | Get the document privileges (permissions). |
BindPdf(srcDoc: Document) | Bind this facade to an existing Document instance. |
ClearInfo() | Clears the standard /Info dictionary entries (Title, Author, Subject, Keywords, Creator, Producer, Trapped, CreationDate, ModDate) on the bound document. |
BindPdf(path: string) | Bind this facade to a PDF file at the given path. |
Save(destStream: Stream) | Save the bound document to a stream. |
Save(destFile: string) | Save the bound document to a file path. |
Close() | Close and release the bound document. |
SaveNewInfo(outputStream: Stream) | Save the modified Info dictionary to a stream. |
SaveNewInfo(outputFile: string) | Save the modified Info dictionary to a file. |
Dispose() | Calls Dispose on this PdfFileInfo instance. |