Skip to content

Commit 7f747ad

Browse files
committed
Added Apply Matte to transparentImage API details
1 parent 35605e9 commit 7f747ad

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

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

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,3 +1350,79 @@ 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 %}
1427+
1428+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Word-to-PDF-Conversion/).

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

0 commit comments

Comments
 (0)