Class PdfDocument
An opened PDF file.
public sealed class PdfDocument : IDisposable
- Inheritance
-
PdfDocument
- Implements
- Inherited Members
Remarks
This is a reader, not an importer. It produces images and the document-level
facts needed to produce them — page count, page sizes, rotation. It does not populate a
WordDocument, is not an IDocumentReader, and does not appear in format
detection as a readable document format; PDF-to-document conversion is a separate problem
with a separate answer.
One instance per thread. The document caches parsed objects, decoded streams and font programs on itself, so two threads rendering from one instance will race. Open a second instance instead — the cost is re-reading the cross-reference table, not the file. This is the same rule the layout renderers follow and, unlike theirs, it is documented.
Properties
- PageCount
Gets the number of pages.
- Pages
Gets the pages, in document order.
- WasRepaired
Gets a value indicating whether the file's cross-reference information was unusable and the object positions had to be recovered by scanning.
Methods
- Dispose()
Releases the document's cached objects.
- Open(byte[], PdfReadOptions?)
Opens a PDF from a byte array. The array is not copied and must not be modified while the document is open.
- Open(Stream, PdfReadOptions?)
Opens a PDF from a stream, reading it fully into memory.
- Open(string, PdfReadOptions?)
Opens a PDF from a file path.