Class DocIORendererSettings
Represent class with setting of Word to PDF conversion.
Inheritance
Namespace: Syncfusion.DocIORenderer
Assembly: Syncfusion.DocIORenderer.NET.dll
Syntax
public class DocIORendererSettings : Object
Examples
This example converts the specified Word Document in to PDF Document with converter settings.
//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);
//Instantiation of DocIORenderer for Word to PDF conversion
DocIORenderer render = new DocIORenderer();
//Sets ExportBookmarks for preserving Word document headings as PDF bookmarks
render.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.Headings;
//Converts Word document into PDF document
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Releases all resources used by the object.
render.Dispose();
//Closes the instance of document objects
pdfDocument.Close();
wordDocument.Close();
Constructors
DocIORendererSettings()
Declaration
public DocIORendererSettings()
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 DocIORenderer settings.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets AutoDetectComplexScript property as true, to detect the complex scripts automatically.
renderer.Settings.AutoDetectComplexScript = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets AutoDetectComplexScript property as true, to detect the complex scripts automatically.
renderer.Settings.AutoDetectComplexScript = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
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.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets the accessible structure tags in converted PDF
renderer.Settings.AutoTag = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets the accessible structure tags in converted PDF
renderer.Settings.AutoTag = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
ChartRenderingOptions
Gets ChartRenderingOptions for charts present in the Word document. By Default ScalingMode is set to Best and ExportImageFormat is set to Jpeg.
Declaration
public ChartRenderingOptions ChartRenderingOptions { get; }
Property Value
Type | Description |
---|---|
ChartRenderingOptions | If not initialized and specified, Default values Jpeg and Best will be set. |
Examples
This example illustrates ChartRenderingOptions property of DocIORenderer settings.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets Export Chart Image Options.
renderer.Settings.ChartRenderingOptions.ImageFormat = ExportImageFormat.Png;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets Export Chart Image Options.
renderer.Settings.ChartRenderingOptions.ImageFormat = ExportImageFormat.Png
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
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 DocIORenderer settings.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets the embed complete font information in converted PDF
renderer.Settings.EmbedCompleteFonts = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets the embed complete font information in converted PDF
renderer.Settings.EmbedCompleteFonts = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
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
This property is supported to embed TrueType fonts only.
Examples
This example illustrates EmbedFonts property of DocIORenderer settings.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets EmbedFonts property as true, to embed fonts in resultant PDF
renderer.Settings.EmbedFonts = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets EmbedFonts property as true, to embed fonts in resultant PDF
renderer.Settings.EmbedFonts = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
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. |
Examples
This example illustrates EnableAlternateChunks property of DocIORenderer settings.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets EnableAlternateChunks property as true, to enable the Alternate chunks in the document
renderer.Settings.EnableAlternateChunks = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets EnableAlternateChunks property as true, to enable the Alternate chunks in the document
renderer.Settings.EnableAlternateChunks = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
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();
//Adds a section into the word document
IWSection section = wordDocument.AddSection();
//Adds a paragraph into the section
IWParagraph paragraph = section.AddParagraph();
//Adds a text into the paragraph
paragraph.AppendText("First Chapter1");
//Applies 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 DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets ExportBookmarks for preserving Word document headings as PDF bookmarks
renderer.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.Headings;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
'Creates a new Word document
Dim wordDocument As WordDocument = New WordDocument
'Adds a section into the word document
Dim section As IWSection = wordDocument.AddSection
'Adds a paragraph into the section
Dim paragraph As IWParagraph = section.AddParagraph
'Adds a text into the paragraph
paragraph.AppendText("First Chapter1")
'Applies 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 DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets ExportBookmarks for preserving Word document headings as PDF bookmarks
renderer.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.Headings
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
OptimizeIdenticalImages
Gets or Sets a value indicating whether to optimize the memory usage for the identical (duplicate) images in Word to PDF conversion.
Declaration
public bool OptimizeIdenticalImages { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True: if need to optimize the identical (duplicate) images in Word to PDF conversion; otherwise, False. |
Remarks
This property is supported to optimize the memory usage for the identical (duplicate) images only.
Examples
This example illustrates OptimizeIdenticalImages property of DocIORenderer settings.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Sets true to optimize the memory usage for identical images
renderer.Settings.OptimizeIdenticalImages = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Sets true to optimize the memory usage for identical images
renderer.Settings.OptimizeIdenticalImages = True
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
PdfConformanceLevel
Declaration
public PdfConformanceLevel PdfConformanceLevel { get; set; }
Property Value
Type |
---|
PdfConformanceLevel |
PreserveFormFields
Declaration
public bool PreserveFormFields { get; set; }
Property Value
Type |
---|
System.Boolean |
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.
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
//Loads an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
//Instantiates DocIORenderer instance for Word to PDF conversion
DocIORenderer renderer = new DocIORenderer();
//Updates the fields present in Word document
renderer.Settings.UpdateDocumentFields = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Closes the instance of Word document object
wordDocument.Close();
//Releases the resources occupied by DocIORenderer instance
renderer.Dispose();
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
pdfDocument.Close();
Dim fileStream As FileStream = New FileStream("Template.docx", FileMode.Open)
'Loads an existing Word document
Dim wordDocument As WordDocument = New WordDocument(fileStream, FormatType.Docx)
'Instantiates DocIORenderer instance for Word to PDF conversion
Dim renderer As DocIORenderer = New DocIORenderer
'Updates the fields present in Word document
renderer.Settings.UpdateDocumentFields = true
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = renderer.ConvertToPDF(wordDocument)
'Closes the instance of Word document object
wordDocument.Close()
'Releases the resources occupied by DocIORenderer instance
renderer.Dispose()
'Saves the PDF file
Dim outputStream As MemoryStream = New MemoryStream
pdfDocument.Save(outputStream)
'Closes the instance of PDF document object
pdfDocument.Close()
Warning
Declaration
public IWarning Warning { get; set; }
Property Value
Type |
---|
IWarning |