Click or drag to resize

PdfConverter Class

This class offers the necessary API to create a PDF document from a Word document: docx, docm, dotx, dotm, doc, dot, rtf, txt, WordML, html and markdown, read from a file, a stream or an array of bytes.
Inheritance Hierarchy
SystemObject
  ExpertPdf.Anywhere.WordToPdfPdfConverter

Namespace: ExpertPdf.Anywhere.WordToPdf
Assembly: ExpertPdf.Anywhere (in ExpertPdf.Anywhere.dll) Version: 22.0
Syntax
public class PdfConverter

The PdfConverter type exposes the following members.

Constructors
 NameDescription
Public methodPdfConverter Creates a Word to PDF converter.
Top
Properties
 NameDescription
Public propertyAccessibilityStandard Gets or sets the accessibility standard the generated document declares. The default value is None.
Public propertyAutoDetectComplexScript Gets or sets whether right-to-left and complex scripts are detected in text that does not say so. The default value is false.
Public propertyBookmarks Gets or sets what the PDF outline is built from. The default is Headings.
Public propertyEmbedCompleteFonts Gets or sets whether whole fonts are embedded rather than the characters used. The default value is false.
Public propertyLanguage Gets or sets the natural language of the document content (for example "en-US"). Required for accessible (PDF/UA) output.
Public propertyLicenseKey Gets or sets the license key
Public propertyOptimizeIdenticalImages Gets or sets whether identical pictures are stored once. The default value is true.
Public propertyPageRanges Gets or sets the pages of the converted document to keep, for example "1,3-5" or "2-" (1-based). The default is every page.
Public propertyPageSetup Gets or sets the page size and margins the document is laid out on. The default is Document: the Word document's own.
Public propertyPassword Gets or sets the password that opens an encrypted Word document.
Public propertyPdfDocumentInfo Gets a reference to an object to set the document information of the generated PDF document: title, author, subject, keywords and creation date.
Public propertyPdfDocumentOptions Gets a reference to an object to control the generated PDF document options. The page size, orientation and margins are used when PageSetup is Options; the margins also make room for the header and footer.
Public propertyPdfFooterOptions Gets a reference to an object to control the generated PDF document footer options
Public propertyPdfHeaderOptions Gets a reference to an object to control the generated PDF document header options
Public propertyPdfSecurityOptions Gets a reference to an object to set the security of the generated PDF document: a password to open it, an owner password, the permissions and the encryption. The document is encrypted only when one of these options is changed from its default.
Public propertyPdfStandardSubset Gets or sets the PDF standard of the generated document. The default is Full.
Public propertyPreserveFormFields Gets or sets whether the document's form fields become PDF form fields. The default value is false: they are drawn as they look.
Public propertyUpdateFields Gets or sets whether the document's fields (dates, page numbers, tables of contents) are updated before it is converted. The default value is true.
Top
Methods
 NameDescription
Public methodGetPdfBytesFromWordBytes(Byte) Gets the PDF document converted from a Word document given as an array of bytes, its format detected from the content (docx, doc, rtf or text).
Public methodGetPdfBytesFromWordBytes(Byte, WordFormat) Gets the PDF document converted from a Word document of the given format given as an array of bytes.
Public methodGetPdfBytesFromWordFile(String) Gets the PDF document converted from a Word file, its format taken from the file extension.
Public methodGetPdfBytesFromWordFile(String, WordFormat) Gets the PDF document converted from a Word file of the given format.
Public methodGetPdfBytesFromWordStream(Stream) Gets the PDF document converted from a Word document in a stream, its format detected from the content (docx, doc, rtf or text).
Public methodGetPdfBytesFromWordStream(Stream, WordFormat) Gets the PDF document converted from a Word document of the given format in a stream.
Public methodSavePdfFromWordFileToFile Saves the PDF document converted from a Word file to a file.
Public methodSavePdfFromWordFileToStream(String, Stream) Saves the PDF document converted from a Word file to a stream.
Public methodSavePdfFromWordFileToStream(String, WordFormat, Stream) Saves the PDF document converted from a Word file of the given format to a stream.
Public methodSavePdfFromWordStreamToFile Saves the PDF document converted from a Word document in a stream to a file.
Public methodSavePdfFromWordStreamToStream(Stream, Stream) Saves the PDF document converted from a Word document in a stream to another stream.
Public methodSavePdfFromWordStreamToStream(Stream, WordFormat, Stream) Saves the PDF document converted from a Word document of the given format in a stream to another stream.
Top
Remarks

The document is laid out by the Word engine. By default (PageSetup = Document) the PDF pages take the page sizes and margins of the Word document; with Options it is reflowed onto the page size, orientation and margins of PdfDocumentOptions. The header and footer of the converter are drawn above and below the document's content, on the margins of the page; the document's own headers and footers are part of its content.

Headings become the PDF outline (Bookmarks), links stay live, and the PDF/A, PDF/X and PDF/UA levels, the security options and the document information apply as they do for the other converters. A document that needs a font the host does not have is drawn with a metric-compatible substitute.

Example
PdfConverter pdfConverter = new PdfConverter();
pdfConverter.PdfDocumentOptions.ShowFooter = true;
pdfConverter.PdfFooterOptions.ShowPageNumber = true;
pdfConverter.SavePdfFromWordFileToFile("report.docx", "report.pdf");
See Also