DocToPDFConverterSettings Class
Represent class with setting of converter.
Inheritance
Inherited Members
Namespace: Syncfusion.DocToPDFConverter
Assembly: Syncfusion.DocToPDFConverter.Base.dll
Syntax
public class DocToPDFConverterSettings
Examples
This example illustrates DocToPDFConverter settings.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiation of DocToPDFConverter for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Skip the updating process for Alternate chunks in the Word document
converter.Settings.EnableAlternateChunks = false;
//Sets the image resolution
converter.Settings.ImageResolution = 640;
//Sets the jpeg image quality to reduce the Pdf file size
converter.Settings.ImageQuality = 100;
//Sets true to optimize the memory usage for identical image
converter.Settings.OptimizeIdenticalImages = false;
//Sets the PdfConformanceLevel
converter.Settings.PdfConformanceLevel = PdfConformanceLevel.None;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiation of DocToPDFConverter for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Skip the updating process for Alternate chunks in the Word document
converter.Settings.EnableAlternateChunks = False
'Sets the image resolution
converter.Settings.ImageResolution = 640
'Sets the jpeg image quality to reduce the Pdf file size
converter.Settings.ImageQuality = 100
'Sets true to optimize the memory usage for identical image
converter.Settings.OptimizeIdenticalImages = False
'Sets the PdfConformanceLevel
converter.Settings.PdfConformanceLevel = PdfConformanceLevel.None
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of PDF document object
pdfDocument.Close(True)
Constructors
DocToPDFConverterSettings()
Declaration
public DocToPDFConverterSettings()
Properties
AutoDetectComplexScript
Gets or sets a value indicates to automatically detect the complex script text present in the Word document during PDF conversion. Default value is false.
Declaration
public bool AutoDetectComplexScript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Trueif it is necessary to automatically detect the complex script text present in the Word document during PDF conversion; otherwise, false. |
Remarks
Set this property to true, only if you have complex script text that is not marked as complex script type (CharacterFormat.ComplexScript is false) in the Word document. You can mark a text as complex script by enabling the WTextRange.CharacterFormat.ComplexScript property. Since automatic detection of complex script text involves validation of all the text in the document and may impact proportionally in Word to PDF conversion performance.
Examples
This example illustrates AutoDetectComplexScript property of DocToPDFConverter settings.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets AutoDetectComplexScript property as true, to detect the complex scripts automatically
converter.Settings.AutoDetectComplexScript = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets AutoDetectComplexScript property as true, to detect the complex scripts automatically
converter.Settings.AutoDetectComplexScript = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of PDF document object
pdfDocument.Close(True)
AutoTag
Gets or sets a value indicates whether the converted PDF document is tagged or not. Default value is false
Declaration
public bool AutoTag { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True: if need to preserve the accessible structure tags from Word document to the converted PDF; otherwise, False. |
Remarks
Examples
This example illustrates how to convert an Word document to PDF with AutoTag property.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets the accessible structure tags in converted PDF
converter.Settings.AutoTag = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets the accessible structure tags in converted PDF
converter.Settings.AutoTag = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Closes the instance of PDF document object
pdfDocument.Close(True)
EmbedCompleteFonts
Gets or sets a value indicating whether to embed the complete font information in the converted PDF document. Default value is false
Declaration
public bool EmbedCompleteFonts { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True: if need to embed the complete font information in the converted PDF document; otherwise, False. |
Remarks
Examples
This example illustrates EmbedCompleteFonts property of DocToPDFConverter settings.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets the embed complete font information in converted PDF
converter.Settings.EmbedCompleteFonts = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets the embed complete font information in converted PDF
converter.Settings.EmbedCompleteFonts = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of PDF document object
pdfDocument.Close(True)
EmbedFonts
Gets or sets a value indicating whether to embed fonts in the converted PDF document. Default value is false
Declaration
public bool EmbedFonts { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True: if need to embed fonts in the converted PDF document; otherwise, False. |
Remarks
Examples
This example illustrates EmbedFonts property of DocToPDFConverter settings.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets EmbedFonts property as true, to embed fonts in resultant PDF
converter.Settings.EmbedFonts = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets EmbedFonts property as true, to embed fonts in resultant PDF
converter.Settings.EmbedFonts = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of PDF document object
pdfDocument.Close(True)
EnableAlternateChunks
Gets or sets a value indicates to enable the Alternate chunks present in the Word document . Default value is True.
Declaration
public bool EnableAlternateChunks { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if need to enable the Alternate chunks; otherwise, false. |
Remarks
This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
EnableFastRendering
Gets or sets a value that indicates whether to convert PDF faster by using direct PDF rendering. The default value is false.
Declaration
public bool EnableFastRendering { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True If True, converts PDF faster by using direct PDF rendering approach. Otherwise uses EMF rendering. otherwise, false. |
Remarks
EMF rendering – Convert a Word document to EMF and render the generated EMF to PDF during Word to PDF conversion. This is default approach, to maintain compatibility for earlier versions. PDF rendering – Directly render a Word document to PDF. This approach is available from 2016 Volume 4 release.
ExportBookmarks
Gets or sets a value indicates whether to export Word document headings or bookmarks as PDF bookmarks while performing Word to PDF conversion. Default value is ExportBookmarkType.BookmarksBookmarks
Declaration
public ExportBookmarkType ExportBookmarks { get; set; }
Property Value
Type | Description |
---|---|
ExportBookmarkType | The ExportBookmarkType member specifies whether Word headings or bookmarks need to be considered in Word to PDF conversion. |
Examples
This example illustrates how to convert an Word document headings to PDF Bookmarks with the help of ExportBookmark property.
//Creates a new Word document
WordDocument wordDocument = new WordDocument();
//Add a section into the word document
IWSection section = wordDocument.AddSection();
//Add a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Add a text into the paragraph
paragraph.AppendText("First Chapter1");
//Apply style for the text
paragraph.ApplyStyle(BuiltinStyle.Heading1);
paragraph.AppendText("First Chapter2");
paragraph.ApplyStyle(BuiltinStyle.Heading2);
paragraph.AppendText("First Chapter3");
paragraph.ApplyStyle(BuiltinStyle.Heading3);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets ExportBookmarks for preserving Word document headings as PDF bookmarks
converter.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.Headings;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Closes the instance of PDF document object
pdfDocument.Close(true);
'creates a new Word document
Dim wordDocument As WordDocument = New WordDocument()
'Add a section into the word document
Dim section As IWSection = wordDocument.AddSection()
'Add a paragraph into the section
Dim paragraph As IWParagraph = section.AddParagraph();
'Add a text into the paragraph
paragraph.AppendText("First Chapter1");
'Apply style for the text
paragraph.ApplyStyle(BuiltinStyle.Heading1);
paragraph.AppendText("First Chapter2");
paragraph.ApplyStyle(BuiltinStyle.Heading2);
paragraph.AppendText("First Chapter3");
paragraph.ApplyStyle(BuiltinStyle.Heading3);
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets ExportBookmarks for preserving Word document headings as PDF bookmarks
converter.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.Headings
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Closes the instance of PDF document object
pdfDocument.Close(True)
ImageQuality
Gets or sets the quality. The value indicates in percentage, max value represents best quality and min value represents best compression.
Declaration
public int ImageQuality { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
The value indicates in percentage, max value represents best quality and min value represents best compression This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
ImageResolution
Sets the image resolution to the image, which are Embedded in the Word document
Declaration
public int ImageResolution { set; }
Property Value
Type |
---|
System.Int32 |
Remarks
This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
OptimizeIdenticalImages
Gets/Sets a value indicating whether to optimize the memory usage for the identical (duplicate) images in Doc to Pdf conversion and converted Pdf document.
Declaration
public bool OptimizeIdenticalImages { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
PdfConformanceLevel
Gets or sets the Pdf document's Conformance-level.
Declaration
public PdfConformanceLevel PdfConformanceLevel { get; set; }
Property Value
Type | Description |
---|---|
PdfConformanceLevel | The PdfConformanceLevel of the PDF document. |
Remarks
This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
PreserveFormFields
Gets or sets a value that indicates whether to preserve Word document form field as editable PDF form field.Default value isfalse.
Declaration
public bool PreserveFormFields { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | TrueIf True, converts Word document form field as editable PDF form field in Word to PDF conversion. Otherwise editable form field will be preserved as text in Word to PDF conversion false. |
Examples
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(@"TemplateFormFields.docx");
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets to preserve the Word document form field as editable PDF form field in PDF document.
converter.Settings.PreserveFormFields = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(@"TemplateFormFields.docx")
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets to preserve the Word document form field as editable PDF form field in PDF document.
converter.Settings.PreserveFormFields = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Closes the instance of PDF document object
pdfDocument.Close(True)
PreserveOleEquationAsBitmap
Gets or sets a value indicating whether to preserve ole equation as bitmap while converting a Word document ot PDF. Default value is false
Declaration
public bool PreserveOleEquationAsBitmap { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True: if need to preserve the ole equation as bitmap; otherwise, False. |
Examples
This example illustrates PreserveOleEquationAsBitmap of DocToPDFConverter settings.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets PreserveOleEquationAsBitmap property as true, to preserve the ole equation as bitmap in resultant PDF
converter.Settings.PreserveOleEquationAsBitmap = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets PreserveOleEquationAsBitmap property as true, to preserve the ole equation as bitmap in resultant PDF
converter.Settings.PreserveOleEquationAsBitmap = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of PDF document object
pdfDocument.Close(True)
RecreateNestedMetafile
Gets or sets a value that indicates whether to regenerate the nested Metafile images present in the Word document during PDF conversion. Default value isfalse.
Declaration
public bool RecreateNestedMetafile { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if it is necessary to regenerate the nested Metafile images present in the Word document during PDF conversion; otherwise false. |
Examples
This example illustrates RecreateNestedMetafile property of DocToPDFConverter settings.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Sets RecreateNestedMetafile property to true to Recreate the Nested Metafile automatically
converter.Settings.RecreateNestedMetafile = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Sets RecreateNestedMetafile property to true to Recreate the Nested Metafile automatically
converter.Settings.RecreateNestedMetafile = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of PDF document object
pdfDocument.Close(True)
UpdateDocumentFields
Gets or sets a value that indicates whether to update fields present in the Word document while converting a Word document to PDF.Default value is false.
Declaration
public bool UpdateDocumentFields { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True If true, updates the fields present in the Word document during Word to PDF conversion. otherwise, false. |
Remarks
This API is alternative for UpdateDocumentFields() UpdateDocumentFields() to improve performance, if your requirement is to update the fields and convert the Word document to PDF.
You can remove UpdateDocumentFields() method and enable UpdateDocumentFields UpdateDocumentFields property to update the Word document fields and convert the Word document to PDF in optimized way.
Examples
The following code example demonstrates how to update the fields present while performing Word to PDF conversion.
//Loads an existing Word document
WordDocument wordDocument = new WordDocument("Template.docx", FormatType.Docx);
//Instantiates DocToPDFConverter instance for Word to PDF conversion
DocToPDFConverter converter = new DocToPDFConverter();
//Updates the fields present in Word document
converter.Settings.UpdateDocumentFields = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Releases the resources occupied by DocToPDFConverter instance
converter.Dispose();
//Closes the instance of PDF document object
pdfDocument.Close(true);
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument("Template.docx", FormatType.Docx)
'Instantiates DocToPDFConverter instance for Word to PDF conversion
Dim converter As DocToPDFConverter = New DocToPDFConverter()
'Updates the fields present in Word document
converter.Settings.UpdateDocumentFields = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf")
'Releases the resources occupied by DocToPDFConverter instance
converter.Dispose()
'Closes the instance of PDF document object
pdfDocument.Close(True)
Warning
Gets or sets the warning that describes the unsupported elements found while converting the specified Word document to PDF.
Declaration
public IWarning Warning { get; set; }
Property Value
Type | Description |
---|---|
IWarning | The warning. |
Remarks
This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.