Skip to content

Commit ac9124c

Browse files
Merge pull request #1766 from syncfusion-content/988636-Apply-Matte-To-Transparent-Images-hotfix
988636 - Added Apply Matte to transparent Image API details in DocIO UG
2 parents 295bd48 + 3d6bbf3 commit ac9124c

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

Document-Processing/Word/Conversions/Word-To-PDF/NET/Word-to-pdf-settings.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,3 +1350,77 @@ document.Close()
13501350
{% endtabs %}
13511351

13521352
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Word-to-PDF-Conversion/Restrict-permission-in-PDF).
1353+
1354+
## Apply Matte to Transparent Images
1355+
1356+
This setting allows you to determine whether to **apply a matte color to transparent images** during Word to PDF conversion, ensuring they render cleanly without unwanted borders or artifacts in the final PDF.
1357+
1358+
The following code sample shows how to apply a matte color to transparent images during Word to PDF conversion.
1359+
1360+
{% tabs %}
1361+
1362+
{% highlight c# tabtitle="C# [Cross-platform]" %}
1363+
1364+
FileStream fileStream = new FileStream("Template.docx", FileMode.Open);
1365+
// Loads an existing Word document
1366+
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
1367+
// Instantiates DocIORenderer instance for Word to PDF conversion
1368+
DocIORenderer renderer = new DocIORenderer();
1369+
// Set to true to apply a matte color to transparent images.
1370+
renderer.Settings.ApplyMatteToTransparentImages = true;
1371+
// Converts Word document into PDF document
1372+
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
1373+
// Closes the instance of Word document object
1374+
wordDocument.Close();
1375+
// Releases the resources occupied by DocIORenderer instance
1376+
renderer.Dispose();
1377+
// Saves the PDF file
1378+
pdfDocument.Save(@"../../../Output/Result.pdf");
1379+
// Closes the instance of PDF document object
1380+
pdfDocument.Close();
1381+
1382+
{% endhighlight %}
1383+
1384+
{% highlight c# tabtitle="C# [Windows-specific]" %}
1385+
1386+
// Loads an existing Word document
1387+
WordDocument wordDocument = new WordDocument("Template.docx");
1388+
// Creates an instance of the DocToPDFConverter - responsible for Word to PDF conversion
1389+
DocToPDFConverter converter = new DocToPDFConverter();
1390+
// Set to true to apply a matte color to transparent images.
1391+
converter.Settings.ApplyMatteToTransparentImages = true;
1392+
// Converts Word document into PDF document
1393+
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
1394+
// Closes the instance of Word document object
1395+
wordDocument.Close();
1396+
// Releases the resources occupied by DocToPDFConverter instance
1397+
converter.Dispose();
1398+
// Saves the PDF file
1399+
pdfDocument.Save(@"../../../Output/Result.pdf");
1400+
// Closes the instance of PDF document object
1401+
pdfDocument.Close();
1402+
1403+
{% endhighlight %}
1404+
1405+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
1406+
1407+
' Loads an existing Word document
1408+
Dim wordDocument As New WordDocument("Template.docx")
1409+
' Creates an instance of the DocToPDFConverter - responsible for Word to PDF conversion
1410+
Dim converter As New DocToPDFConverter()
1411+
' Set to true to apply a matte color to transparent images
1412+
converter.Settings.ApplyMatteToTransparentImages = True
1413+
' Converts Word document into PDF document
1414+
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
1415+
' Closes the instance of Word document object
1416+
wordDocument.Close()
1417+
' Releases the resources occupied by DocToPDFConverter instance
1418+
converter.Dispose()
1419+
' Saves the PDF file
1420+
pdfDocument.Save("../../../Output/Result.pdf")
1421+
' Closes the instance of PDF document object
1422+
pdfDocument.Close()
1423+
1424+
{% endhighlight %}
1425+
1426+
{% endtabs %}

Document-Processing/Word/Conversions/Word-To-PDF/NET/word-to-pdf.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Convert Word to PDF in C# | DocIO | Syncfusion
2+
title: Convert Word to PDF in C# using DocIO | Syncfusion
33
description: Learn how to convert a Word document to PDF, PDF/A, and PDF/UA using the .NET Word (DocIO) library without Microsoft Word or interop dependencies.
44
platform: document-processing
55
control: DocIO
66
documentation: UG
77
---
88

9-
# Convert Word to PDF using Syncfusion<sup>&reg;</sup> Word (DocIO) library
9+
# Convert Word to PDF using Syncfusion® Word (DocIO) library
1010

1111
Syncfusion<sup>&reg;</sup> Word library (DocIO) allows you to convert Word document to PDF within a few lines of code in .NET applications and also it does not require Adobe and Microsoft Word application to be installed in the machine. Using this, you can create an input Word document from scratch or load an existing Word document and then easily convert to PDF.
1212

@@ -238,6 +238,10 @@ You can preserve Ole Equation as bitmap image in the converted PDF document. For
238238

239239
You can restrict all the permission in a PDF document using [PdfPermissionsFlags](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.PdfPermissionsFlags.html). For further information, click [here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf-settings#restrict-all-permission-in-a-pdf-document).
240240

241+
### Apply Matte to Transparent Images
242+
243+
This setting allows you to determine whether to **apply a matte color to transparent images** during Word to PDF conversion, ensuring they render cleanly without unwanted borders or artifacts in the final PDF. For further information, click [here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf-settings#restrict-all-permission-in-a-pdf-document).
244+
241245
## Font Substitution
242246

243247
When the necessary fonts used in the Word document has not been installed in the production machine, then Essential<sup>&reg;</sup> DocIO uses the ”Microsoft Sans Serif” as default font for rendering the text. This leads to preservation difference in generated PDF as each font has different glyphs for characters.

Document-Processing/Word/Conversions/Word-To-PDF/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ You can preserve Ole Equation as bitmap image in the converted PDF document. For
240240

241241
You can restrict all the permission in a PDF document using [PdfPermissionsFlags](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Security.PdfPermissionsFlags.html). For further information, click [here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf-settings#restrict-all-permission-in-a-pdf-document).
242242

243+
### Apply Matte to Transparent Images
244+
245+
This setting allows you to determine whether to **apply a matte color to transparent images** during Word to PDF conversion, ensuring they render cleanly without unwanted borders or artifacts in the final PDF. For further information, click [here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf-settings#restrict-all-permission-in-a-pdf-document).
246+
243247
## Font Substitution
244248

245249
When the necessary fonts used in the Word document has not been installed in the production machine, then Essential<sup>&reg;</sup> DocIO uses the ”Microsoft Sans Serif” as default font for rendering the text. This leads to preservation difference in generated PDF as each font has different glyphs for characters.

0 commit comments

Comments
 (0)