PdfDocument Class
Contains information about a loaded PDF file.
public sealed class PdfDocument : IDisposable
Example
The following example opens a PDF file and saves each page as an SVG file.
Convert PDF to SVG
using (var doc = PdfDocument.Open("input.pdf")) { var pageIndex = 0; foreach (var page in doc.Pages) { page.SaveAsSvg($"output-{pageIndex++}.svg"); } }
If the document is password protected, the password must be specified in OpenOptions when the document is opened to allow conversion.
Converting a password protected document
var openOptions = new OpenOptions { Password = "document password" }; using (var doc = PdfDocument.Open("input.pdf", openOptions)) { var pageIndex = 0; foreach (var page in doc.Pages) { page.SaveAsSvg($"output-{pageIndex++}.svg"); } }
Properties
Info | Gets information about the document provided by the author. | |
IsEncrypted | Gets a value indicating whether this document is encrypted. | |
Pages | Gets a collection of the pages in this PDF document. | |
Permissions | Gets information about which operations that the document author has allowed for this document. |
Methods
Dispose | Closes the PDF file. | |
Open(String, OpenOptions, CancellationToken) | Loads a PDF file from a file path. | |
Open(Stream, Boolean, OpenOptions, CancellationToken) | Loads a PDF file from a stream. | |
OpenAsync(String, OpenOptions, CancellationToken) | Loads a PDF file from a file path asynchronously. | |
OpenAsync(Stream, Boolean, OpenOptions, CancellationToken) | Loads a PDF file from a stream asynchronously. |