PdfDocument Class

Contains information about a loaded PDF file.

public sealed class PdfDocument : IDisposable
Namespace
PdfToSvg
Package
PdfToSvg.NET (since v0.1.0)
Inheritance
System.Object PdfToSvg.PdfDocument

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 pageNo = 1;

    foreach (var page in doc.Pages)
    {
        page.SaveAsSvg($"output-{pageNo++}.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 pageNo = 1;

    foreach (var page in doc.Pages)
    {
        page.SaveAsSvg($"output-{pageNo++}.svg");
    }
}

Properties

ImagesGets an enumerable of images embedded in this document.
InfoGets information about the document provided by the author.
IsEncryptedGets a value indicating whether this document is encrypted.
PagesGets a collection of the pages in this PDF document.
PermissionsGets information about which operations that the document author has allowed for this document.

Methods

DisposeCloses 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.

See Also

PdfToSvg Namespace