Table of Contents

Class PdfExport

Namespace
Rustaveli.Pdf
Assembly
Rustaveli.Pdf.dll

Exports a document as PDF.

public static class PdfExport
Inheritance
PdfExport
Inherited Members

Remarks

The file is written in managed code: fonts are subset to the glyphs the document uses, images are embedded as they were encoded where PDF can carry them so, and objects stream out as pages finish rather than accumulating in memory. Documents can be exported in parallel; each export has its own writer and shares only the typefaces.

A document holds its layout progress while it is set, so an export that begins while another is under way lays out a copy composed afresh: one document can be exported from several threads at once.

Methods

ExportPdf(Document, PdfExportOptions?)

Exports the document as PDF, returning the file's bytes.

public static byte[] ExportPdf(this Document document, PdfExportOptions? options = null)

Parameters

document Document
options PdfExportOptions

Returns

byte[]

ExportPdf(Document, Stream, PdfExportOptions?)

Exports the document as PDF, writing it to stream.

public static void ExportPdf(this Document document, Stream stream, PdfExportOptions? options = null)

Parameters

document Document
stream Stream
options PdfExportOptions

Remarks

Pages are written as they are set, so a large document never has to fit in memory. The stream is not closed. If the export fails the stream holds part of a document; export to memory first where that matters.

ExportPdf(Document, string, PdfExportOptions?)

Exports the document as a PDF file at path.

public static void ExportPdf(this Document document, string path, PdfExportOptions? options = null)

Parameters

document Document
path string
options PdfExportOptions

Remarks

The file is written beside its destination and moved into place once complete, so a failed export leaves whatever was at path untouched rather than a truncated document.

ExportPdfAndOpen(Document, PdfExportOptions?)

Exports the document to a PDF in the temporary folder and opens it in the viewer the system uses for PDFs, for a look while writing the document. Returns where the file was written.

public static string ExportPdfAndOpen(this Document document, PdfExportOptions? options = null)

Parameters

document Document
options PdfExportOptions

Returns

string