diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/advanced-installation.md b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/advanced-installation.md index d1b94966ce..a88f4b5f44 100644 --- a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/advanced-installation.md +++ b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/advanced-installation.md @@ -1,5 +1,5 @@ --- -title: Advanced installation of HTML to PDF in .NET PDF Library | Syncfusion® +title: Advanced installation of HTML to PDF in .NET PDF Library | Syncfusion description: Explore our guide on how to convert HTML to PDF using the Blink rendering engine with various features like TOC, partial web page to PDF, and more. platform: document-processing control: PDF @@ -8,9 +8,16 @@ documentation: UG # Advanced Installation -You can download and install the HTML to PDF converter for Windows, Linux and Mac platforms. +The [HTML to PDF Converter](https://www.syncfusion.com/document-sdk/net-pdf-library/html-to-pdf) uses the Blink rendering engine to convert HTML, web pages, and web content into PDF documents. The converter is available for Windows, Linux, and macOS. -[https://www.syncfusion.com/account/downloads](https://www.syncfusion.com/account/downloads ) +**Prerequisites:** +Before installing the HTML to PDF Converter: + +* Ensure that you have a valid Syncfusion license. +* Verify that your development environment supports the version of Syncfusion® PDF Library you are using. +* Download the latest installer package from the Syncfusion Downloads page: + +[https://www.syncfusion.com/account/downloads](https://www.syncfusion.com/account/downloads) ## Windows diff --git a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/features.md b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/features.md index 462cbcf08a..3e3b7c195b 100644 --- a/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/features.md +++ b/Document-Processing/PDF/Conversions/HTML-To-PDF/NET/features.md @@ -1,16 +1,20 @@ --- title: HTML to PDF converter features in .NET PDF Library | Syncfusion -description: Learn how to convert HTML to PDF using Blink rendering engines (Blink, WebKit and IE) with various features like TOC, partial web page to PDF etc. +description: Learn how to convert HTML to PDF using the Blink rendering engine with features like table of contents, partial page conversion, and more. platform: document-processing control: PDF documentation: UG --- -# HTML converter Features +# HTML converter features + +The Syncfusion HTML to PDF converter uses the Blink rendering engine (based on Chromium) to convert HTML pages, HTML strings, and SVG content into high-quality PDF documents and images. It supports a wide range of features including authentication, headers and footers, JavaScript execution, accessibility, and more. + +N> The Blink rendering engine is fully supported in both .NET Core (cross-platform) and .NET Framework (Windows-specific) applications. All examples in this document include code for both targets. ## URL to PDF -To convert website URL or local HTML file to PDF document using [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_) method in [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class. refer to the following code example. +To convert a website URL or local HTML file to a PDF document, use the [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_) method of the [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class. Refer to the following code example. {% tabs %} @@ -68,15 +72,15 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## HTML String to PDF -The HTML to PDF converter provides support for converting HTML string to PDF. While converting HTML string to PDF, converter provides option to specify the base URL. +The HTML to PDF converter supports converting an HTML string to a PDF. While converting an HTML string to a PDF, the converter provides an option to specify the base URL. -baseURL: Path of the resources (images, style sheets, scripts.,) used in the input HTML string. +**baseURL:** Path of the resources (images, style sheets, scripts, etc.) used in the input HTML string. -For the following HTML string, the baseURL will be the path of the syncfusion_logo.gif image. +For the following HTML string, the `baseURL` will be the path of the `syncfusion_logo.gif` image. -For example, if the above image is in “C:/Temp/ HTMLFiles/syncfusion_logo.gif” location, then the baseURL will be as follows. +For example, if the above image is in the `C:/Temp/HTMLFiles/syncfusion_logo.gif` location, then the `baseURL` will be as follows. -baseURL: C:/Temp/HTMLFiles/ +**baseURL:** `C:/Temp/HTMLFiles/` To convert the HTML string to PDF using [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_System_String_) method, refer to the following code example. @@ -150,7 +154,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## URL to Image -To convert website URL or local HTML file to Image using [ConvertToImage](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_ConvertToImage_System_String_) method, refer to the following code example. +To convert a website URL or local HTML file to an image, use the [ConvertToImage](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_ConvertToImage_System_String_) method. Refer to the following code example. {% tabs %} @@ -170,7 +174,7 @@ File.WriteAllBytes(Path.GetFullPath(@"Output/Output.jpg"), image.ImageData); {% highlight c# tabtitle="C# [Windows-specific]" %} -using Syncfusion.Drawing; +using System.Drawing; using Syncfusion.HtmlConverter; //Initialize HTML to PDF converter @@ -190,9 +194,9 @@ Imports Syncfusion.HtmlConverter 'Initialize HTML to PDF converter. Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter() 'Convert URL to Image -Dim image As Image[] = htmlConverter.ConvertToImage("https://www.google.com") +Dim image As Image() = htmlConverter.ConvertToImage("https://www.google.com") 'Save the image. -File.WriteAllBytes(Path.GetFullPath(@"Output/Output.jpg"), image.ImageData) +File.WriteAllBytes(Path.GetFullPath("Output/Output.jpg"), image.ImageData) {% endhighlight %} @@ -202,15 +206,15 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## HTML String to Image -The Blink rendering engine supports converting HTML string to Image. While converting HTML string to Image, converter provides an option to specify the base URL. +The Blink rendering engine supports converting an HTML string to an image. While converting an HTML string to an image, the converter provides an option to specify the base URL. -baseURL: Path of the resources (images, style sheets, scripts.,) used in the input HTML string. +**baseURL:** Path of the resources (images, style sheets, scripts, etc.) used in the input HTML string. -For the following HTML string, the baseURL will be the path of the syncfusion_logo.gif image. +For the following HTML string, the `baseURL` will be the path of the `syncfusion_logo.gif` image. -For example, if the previous image is in “C:/Temp/ HTMLFiles/syncfusion_logo.gif” location then the baseURL will be as follows. +For example, if the above image is in the `C:/Temp/HTMLFiles/syncfusion_logo.gif` location, then the `baseURL` will be as follows. -baseURL: C:/Temp/HTMLFiles/ +**baseURL:** `C:/Temp/HTMLFiles/` To convert the HTML string to Image using [ConvertToImage](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_ConvertToImage_System_String_System_String_) method, refer to the following code example. @@ -267,9 +271,9 @@ Dim htmlText As String = "
@@ -1727,8 +1732,7 @@ document.Close(True)
## Viewport
-Adjusting the HTML content size in PDF is possible by using the [ViewPortSize](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_ViewPortSize) property of Blink HTML converter.
-Refer to the following code snippet to adjust Blink viewport.
+The HTML content size in the PDF can be adjusted by using the [ViewPortSize](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_ViewPortSize) property of the Blink HTML converter. Refer to the following code snippet to adjust the Blink viewport.
N> The HTML converter internally uses the viewport size in points.
@@ -1760,7 +1764,7 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
-using Syncfusion.Drawing;
+using System.Drawing;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
@@ -1858,7 +1862,7 @@ Imports Syncfusion.Pdf
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter()
'Convert Partial webpage to PDF
-Dim document As PdfDocument = htmlConverter. ConvertPartialHtml("input.html", "pic")
+Dim document As PdfDocument = htmlConverter.ConvertPartialHtml("input.html", "pic")
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
@@ -1870,13 +1874,14 @@ You can download a complete working sample from [GitHub](https://github.com/Sync
## HTML to single PDF page
-By using this [SinglePageLayout](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_SinglePageLayout) property, you can render the whole HTML content into a single PDF page. The PDF page size is limited to 14400 points. There are two options to enable this feature since this is disabled by default.
+By using the [SinglePageLayout](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_SinglePageLayout) property, you can render the entire HTML content into a single PDF page. The PDF page size is limited to 14400 points. There are two options to enable this feature. This feature is disabled by default.
- 1. FitWidth
- 2. FitHeight
+1. **FitWidth**
+2. **FitHeight**
-Fit width option: Using this option, the HTML converter adjusts the PDF page height based on the HTML content height. PDF page width remains constant for this option.
-Fit height option: Using this option, the HTML converter scale the HTML content and PDF page width to render the whole HTML content within the height. PDF page height remains constant for this option.
+**FitWidth option:** Using this option, the HTML converter adjusts the PDF page height based on the HTML content height. The PDF page width remains constant for this option.
+
+**FitHeight option:** Using this option, the HTML converter scales the HTML content and PDF page width to render the whole HTML content within the height. The PDF page height remains constant for this option.
Refer to the following code snippet.
@@ -1954,12 +1959,13 @@ document.Close(True)
## Layout Result
-Getting height of the HTML content in PDF document is possible by using the [PdfLayoutResult](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfLayoutResult.html) class. Using this result, you can add contents after converting HTML to PDF. Refer to the following code example.
+Getting the height of the HTML content in the PDF document is possible by using the [PdfLayoutResult](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfLayoutResult.html) class. Using this result, you can add content after converting HTML to PDF. Refer to the following code example.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
+using Syncfusion.Drawing;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
@@ -1981,6 +1987,7 @@ document.Close(true);
{% highlight c# tabtitle="C# [Windows-specific]" %}
+using System.Drawing;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
@@ -2002,6 +2009,7 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
Imports Syncfusion.HtmlConverter
Imports Syncfusion.Pdf
@@ -2022,12 +2030,12 @@ document.Close(True)
{% endtabs %}
-## Windows status
+## Window status
-Windows status can be used instead of additional delay. In additional delay, the amount of time required for loading the resources is unpredictable. This behavior can be avoided by using [WindowStatus ](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_WindowStatus) property.
+The window status can be used instead of the additional delay. With the additional delay, the amount of time required for loading the resources is unpredictable. This behavior can be avoided by using the [WindowStatus](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_WindowStatus) property.
N> This feature requires changes in the HTML file.
-N> If windows status does not match in code and HTML, then the converter will meet with deadlock.
+N> If the window status does not match between the code and the HTML, then the converter will encounter a deadlock.
Refer to the following code snippet.
@@ -2314,7 +2322,7 @@ document.Close(true);
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf;
-using Syncfusion.Drawing;
+using System.Drawing;
//Initialize HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
@@ -2384,8 +2392,8 @@ Dim compositeField As PdfCompositeField = New PdfCompositeField(font, PdfBrushes
compositeField.Draw(footer.Graphics, PointF.Empty)
'Assign the footer element to PdfFooter of Blink converter settings.
blinkConverterSettings.PdfFooter = footer
-'Set Blink viewport size.
-blinkConverterSettings.ViewPortSize = new Size(1024, 0)
+'Set Blink viewport size.
+blinkConverterSettings.ViewPortSize = New Size(1024, 0)
'Assign Blink converter settings to HTML converter.
htmlConverter.ConverterSettings = blinkConverterSettings
'Convert URL to PDF document.
@@ -2664,12 +2672,13 @@ N> The HtmlHeader and HtmlFooter properties have certain limitatio
## Inject custom CSS
-The Blink rendering engine supports the injection of custom CSS to be applied to HTML or a URL before rendering it into a PDF document using the 'Css' property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class
+The Blink rendering engine supports the injection of custom CSS to be applied to an HTML string or a URL before rendering it into a PDF document using the [Css](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_Css) property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/HTML%20to%20PDF/Blink/Inject_custom_CSS_to_HTML/.NET/Inject_custom_CSS_to_HTML/Program.cs, 300" %}
+
using Syncfusion.Drawing;
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
@@ -2718,9 +2727,9 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
Imports Syncfusion.HtmlConverter
Imports Syncfusion.Pdf
-Imports System.Drawing
'Initialize the HTML to PDF converter.
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter()
@@ -2729,14 +2738,14 @@ Dim blinkConverterSettings As BlinkConverterSettings = New BlinkConverterSetting
blinkConverterSettings.ViewPortSize = New Size(1280, 0)
blinkConverterSettings.Margin.All = 30
'Set custom CSS
-blinkConverterSettings.Css = "body {\r\n background-color: red; \r\n}"
+blinkConverterSettings.Css = "body { background-color: red; }"
htmlConverter.ConverterSettings = blinkConverterSettings
'Convert the URL to PDF document.
-Dim document As PdfDocument = htmlConverter.Convert(https://www.syncfusion.com)
+Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com")
'Save and close the PDF document.
document.Save("Output.pdf")
-document.Close(true)
+document.Close(True)
{% endhighlight %}
@@ -2744,11 +2753,11 @@ document.Close(true)
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Inject_custom_CSS_to_HTML).
-N> We're injecting custom CSS into the header tag of the input HTML/URL.
+N> The custom CSS is injected into the `` tag of the input HTML or URL before rendering.
## Inject custom JavaScript
-The Blink rendering engine offers support for injecting custom JavaScript to be applied to the HTML or a URL before rendering it into a PDF document using the 'JavaScript' property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class.
+The Blink rendering engine offers support for injecting custom JavaScript to be applied to an HTML string or a URL before rendering it into a PDF document using the [JavaScript](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_JavaScript) property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class.
{% tabs %}
@@ -2802,15 +2811,15 @@ document.Close(true);
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
+Imports System.Drawing
Imports Syncfusion.HtmlConverter
Imports Syncfusion.Pdf
-Imports System.Drawing
'Initialize the HTML to PDF converter.
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter()
Dim blinkConverterSettings As BlinkConverterSettings = New BlinkConverterSettings()
'Set the Blink viewport size.
-blinkConverterSettings.ViewPortSize = new Size(1280, 0)
+blinkConverterSettings.ViewPortSize = New Size(1280, 0)
blinkConverterSettings.Margin.All = 30
'Set the Custom JavaScript
blinkConverterSettings.JavaScript = "document.querySelectorAll('img').forEach((node)=>{node.remove();})"
@@ -2820,7 +2829,7 @@ Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com"
'Save and close the PDF document.
document.Save("Output.pdf")
-document.Close(true)
+document.Close(True)
{% endhighlight %}
@@ -2828,11 +2837,11 @@ document.Close(true)
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Inject_custom_JavaScript_to_HTML).
-N> Note: We're injecting custom JavaScript into the header tag of the input HTML/URL.
+N> The custom JavaScript is injected into the `` tag of the input HTML or URL before rendering.
## Performance optimization
-The Blink rendering engine provides support for reusing the browser process to optimize the HTML to a PDF performance for multiple operations using the 'ReuseBrowserProcess' property of the [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class.
+The Blink rendering engine provides support for reusing the browser process to optimize HTML to PDF performance for multiple operations using the [ReuseBrowserProcess](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_ReuseBrowserProcess) property of the [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class.
{% tabs %}
@@ -2936,9 +2945,9 @@ You can download a complete working sample from [GitHub](https://github.com/Sync
## Temporary path
-The Blink HTML converter launching Chrome browser to perform conversion. While launching Chrome browser, temporary files are created in a temporary folder.
+The Blink HTML converter launches a Chrome browser to perform the conversion. While launching the Chrome browser, temporary files are created in a temporary folder.
-By default, HTML converter takes system temporary path (C:\Users\<
| Exception | -BlinkBinaries access is denied in server. + | BlinkBinaries access is denied on the server. |
|---|---|---|
| Reason | -If the BlinkBinaries folder does not have elevated permission for the respective user, then the Blink HTML converter may throw this exception. + | If the BlinkBinaries folder does not have elevated permission for the respective user, the Blink HTML converter may throw this exception. |
| Solution | -You can add read/write/execute permission to for the BlinkBinaries folder for the respective user group. + | You can add read/write/execute permission for the BlinkBinaries folder to the respective user group. |
| Exception | -Blink rendering engine only supported from .NET Framework 4.5. + | Blink rendering engine is only supported from .NET Framework 4.5. | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Reason | -HTML conversion using blink is only supported from .NET framework 4.5 or above. + | HTML conversion using Blink is only supported from .NET Framework 4.5 or above. | |||||||
| Solution | -The application should target .NET Framework 4.5 or above to convert the HTML using the Blink rendering engine. + | The application should target .NET Framework 4.5 or above to convert HTML using the Blink rendering engine. | |||||||
| Reason | -The exception may occur in the Linux CentOS/Docker environment due to the Chrome browser unable to launch from sandbox mode in CentOS. + | This exception may occur in the Linux CentOS/Docker environment because the Chrome browser is unable to launch from sandbox mode in CentOS. | |||||||
| Solution | -To overcome the exception in the Linux CentOS/Docker environment, provide the execute permission for chrome and chrome-wrapper files inside the BlinkBinaries folder. + | To overcome this exception in the Linux CentOS/Docker environment, provide execute permission for the chrome and chrome-wrapper files inside the BlinkBinaries folder.
-Refer to the following screenshot: +Refer to the following screenshots:
-Also, please add the following command line arguments in our converter setting. +Also, add the following command line arguments in the converter settings.
| |||||||
| Reason | -The required dependencies for the Chromium are not installed on the system. + | The required dependencies for Chromium are not installed on the system. | |||||||
| Solution - | -Ensure all required dependencies for the Chromium are installed on the system. This may include additional libraries or packages. -Ensure all required dependencies for the Chromium are installed on the system. This may include additional libraries or packages. -Here's how you can modify your Docker file: + | ||||||||
| Solution + | +Ensure all required dependencies for Chromium are installed on the system. This may include additional libraries or packages. Here's how you can modify your Docker file: {% highlight dockerfile %} FROM your-base-image RUN apt-get update && apt-get install -yq --no-install-recommends \ @@ -227,8 +225,8 @@ RUN apt-get update && apt-get install -yq --no-install-recommends \ libgbm1 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -{% endhighlight %} - | +{% endhighlight %} +

| Issue | -Conversion failure in windows server 2012 R2. + | Conversion failure in Windows Server 2012 R2. |
|---|---|---|
| Reason | -The issue may happen due to windows server environment permission restriction. + | The issue may occur due to Windows Server environment permission restrictions. |
| Solution | -We can resolve this permission related failure in the Blink rendering engine using below command line arguments in our converter settings. + | This permission-related failure in the Blink rendering engine can be resolved using the following command line arguments in the converter settings.
-{% highlight C# tabtitle="C#" %} +{% highlight c# %} //Set command line arguments to run without sandbox. blinkConverterSettings.CommandLineArguments.Add("--no-sandbox"); @@ -648,35 +646,35 @@ blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); |
| Exception | -Converting the HTML to PDF fails in x32 bit windows system environment. + | Converting HTML to PDF fails in x32 bit Windows system environment. |
|---|---|---|
| Reason | -The existing x64 bit Blink binaries windows are not compatible with x32 bit windows system architecture. + | The existing x64 bit Blink binaries for Windows are not compatible with the x32 bit Windows system architecture. |
| Solution | -To overcome this issue, we can use the x32 bit blink binaries. The x32 bit windows blink binaries are compatible with the x32 bit windows system environment. Please download the x32 bit blink binaries for windows here and replace these binaries in the existing x64 bit blink binaries folder. + | To overcome this issue, use the x32 bit Blink binaries. The x32 bit Windows Blink binaries are compatible with the x32 bit Windows system environment. Please download the x32 bit Blink binaries for Windows here and replace these binaries in the existing x64 bit Blink binaries folder. |
| Issue | -Hyperlinks appearances do not navigate to their referenced URLs when using `CreateTemplate` and `DrawPdfTemplate` methods + | Hyperlink appearances do not navigate to their referenced URLs when using `CreateTemplate` and `DrawPdfTemplate` methods |
|---|---|
| Solution | A workaround involves manually extracting and re-applying hyperlink annotations. This can be achieved by following these steps: -1.Extract Annotations: Before creating and drawing the PDF template, extract all annotations, specifically hyperlink annotations, from the original PDF document. -2.Draw PDF Template: Use the CreateTemplate and DrawPdfTemplate methods to draw the PDF content into a new document. -3.Incorporate Annotations: After the template has been drawn, programmatically add the extracted hyperlink annotations to the corresponding positions in the new document. This will restore the interactive functionality of the hyperlinks. +1. Extract Annotations: Before creating and drawing the PDF template, extract all annotations, specifically hyperlink annotations, from the original PDF document. +2. Draw PDF Template: Use the CreateTemplate and DrawPdfTemplate methods to draw the PDF content into a new document. +3. Incorporate Annotations: After the template has been drawn, programmatically add the extracted hyperlink annotations to the corresponding positions in the new document. This will restore the interactive functionality of the hyperlinks. Please refer to the sample project: HTML-to-PDF-Hyperlink |
| Exception | -The specified module could not be found in windows server 2012 R2. + | The specified module could not be found in Windows Server 2012 R2. |
|---|---|---|
| Reason | -The issue happened because the Windows Server Essentials Media Pack was missing in the Windows server 2012 R2. + | This issue occurs because the Windows Server Essentials Media Pack is missing on Windows Server 2012 R2. |
| Solution | -We can resolve this issue by installing the Windows Server Essentials Media Pack. + | This issue can be resolved by installing the Windows Server Essentials Media Pack.
To install the Windows Server Essentials Media Pack, first install the Windows Server Essentials. -1. Open the Server Manager in the Taskbar. -2. Click Manage in the Server Manager and select Add Roles and Features option. -3. Select the Role-based or feature-based installation option and click next. -4. In the left side menu, select server roles, then Windows Server Essentials Experience in the server roles and then click next. -5. Now, the Windows Server Essentials will be installed. -6. After successful installation, install the Windows Server Essentials Media Pack. -Go to the official website to download and Install the Windows Server Essentials Media Pack. +1.Open the Server Manager in the Taskbar. +2.Click Manage in the Server Manager and select Add Roles and Features. +3.Select the Role-based or feature-based installation option and click Next. +4.In the left side menu, select Server Roles, then enable Windows Server Essentials Experience, and click Next. +5.The Windows Server Essentials will be installed. +6.After successful installation, install the Windows Server Essentials Media Pack. +Go to the official website to download and install the Windows Server Essentials Media Pack. -{{'**Note:**'| markdownify }}This version is only applicable to Windows Server 2012 R2 Standard. +**Note:** This version is only applicable to Windows Server 2012 R2 Standard. |

| Exception @@ -779,7 +765,7 @@ Refer to the following package reference: | ||
|---|---|---|
| Reason | -The existing x64-bit Blink binaries for Linux are not compatible with the x64 ARM Mac M1 system architecture with Linux Docker. + | The existing x64-bit Blink binaries for Linux are not compatible with the ARM64 Mac M1 system architecture running Linux Docker. | Solution |
-To resolve this issue, we can install the chromium using the docker file and set the Blink Path to the location where chromium is installed.
+To resolve this issue, install Chromium using the Dockerfile and set the Blink Path to the location where Chromium is installed.
-Docker File: +Dockerfile: -{% highlight C# tabtitle="C#" %} +{% highlight dockerfile %} FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base RUN apt-get update && apt-get install -y \ @@ -806,9 +792,9 @@ EXPOSE 443 {% endhighlight %} -Code example: +Code example: -{% highlight C# tabtitle="C#" %} +{% highlight c# %} BlinkConverterSettings settings = new BlinkConverterSettings(); @@ -833,7 +819,7 @@ settings.BlinkPath = @"/usr/lib/chromium/chromium"; |
| Reason | -We do not have the support for adding a custom CSS style in the HTML header and footer. + | Adding a custom CSS style in the HTML header and footer is not supported. | Solution |
-To resolve this issue, we can add inline styles in element. However, we have attached the sample and output documents for your reference.
+To resolve this issue, add inline styles to the element. The following sample demonstrates the approach.
-{% highlight C# tabtitle="C#" %} +{% highlight c# %} + +using Syncfusion.Drawing; +using Syncfusion.HtmlConverter; +using Syncfusion.Pdf; HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Initialize blink converter settings. @@ -862,7 +852,7 @@ blinkConverterSettings.HtmlFooter = " Hello World ",string.Empty);
+PdfDocument document = htmlConverter.Convert("Hello World ", string.Empty);
//Save and close a PDF document.
document.Save("Output.pdf");
@@ -870,17 +860,17 @@ document.Close(true);
{% endhighlight %}
-You can downloaded a complete working sample from GitHub.
+You can download a complete working sample from GitHub.
|


| Reason | -The reported issue occurs due to an unsupported OS platform with the latest binaries. + | This issue occurs due to an unsupported OS platform with the latest binaries. |
|---|---|---|
| Issue | -Converting HTML to PDF using the Alpine Docker image, it crashes after the first conversion. + | Converting HTML to PDF using the Alpine Docker image crashes after the first conversion. | ||
|---|---|---|---|---|
| Reason | -- + | + The issue occurs within Chromium specifically for Alpine. | @@ -1141,9 +1123,9 @@ The issue occurs within Chromium specifically for Alpine.||
| Solution | -We can resolve this issue by adding command-line arguments to the Blink converter settings. Please refer to the code snippet below. +This issue can be resolved by adding command-line arguments to the Blink converter settings. Please refer to the code snippet below: -{% highlight C# %} +{% highlight c# %} blinkConverterSettings.CommandLineArguments.Add("--disable-gpu"); @@ -1163,20 +1145,20 @@ blinkConverterSettings.CommandLineArguments.Add("--disable-gpu"); | |||
| Reason | -- -The reported issue may occur due to missing of crashpad handler configuration in your docker file + | + +This issue may occur due to missing crashpad handler configuration in the Dockerfile. | ||
| Solution |
-You can try the below solution steps to overcome the reported issue 'Failed to launch Base! chrome_crashpad_handler: --database is required', +You can try the following solution steps to overcome the issue `'Failed to launch Base! chrome_crashpad_handler: --database is required'`: -Step 1: Kindly try the below docker file changes in your sample to resolve the chrome_crashpad_handler issue. +Step 1: Apply the following Dockerfile changes in your sample to resolve the `chrome_crashpad_handler` issue. -{% highlight C# %} +{% highlight dockerfile %} FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine LABEL pipelineName="PDFSearch" \ @@ -1218,22 +1200,22 @@ ENTRYPOINT ["dotnet", "Ops.PDFSearch.Web.dll"] {% endhighlight %} -We have attached the modified docker file for your reference Docker file. +A modified Dockerfile is available for your reference: Docker file. -Step 2: From chromium version 128.x.x.x.x -database flag required for chrome Crashpad handler. So, it may cause the issue on your end. So kindly try the below steps and it may resolve the reported issue. +Step 2: From Chromium version 128.x.x.x.x, the `--database` flag is required for the Chrome crashpad handler. This may cause the issue on your end. Try the steps below to resolve the issue. -Add below commands in Docker file: +Add the following commands in the Dockerfile: -{% highlight C# %} +{% highlight dockerfile %} RUN mkdir -p /var/www/.config/google-chrome/Crashpad RUN chown -R www-data:www-data /var/www/.config {% endhighlight %} -Add below command-line arguments in conversion code +Add the following command-line arguments in the conversion code: -{% highlight C# %} +{% highlight c# %} if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { @@ -1248,7 +1230,7 @@ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {% endhighlight %} -Please refer the Chromium forum link. for more information about the reported issue +Please refer to the Chromium forum link for more information about this issue. |
|||
| Reason | -+ | The Blink rendering engine is not supported for HTML to PDF conversion in Azure App Service (Windows) due to the GDI limitations and restrictions inherent in the Azure App Service environment. | @@ -1273,14 +1255,14 @@ The Blink rendering engine is not supported for HTML to PDF conversion in AzuSolution |
-Use Blink Rendering Engine in Azure App Service Linux or Azure Functions Linux +Use the Blink Rendering Engine in Azure App Service Linux or Azure Functions Linux To perform HTML to PDF conversion using the Blink rendering engine, you can use the following alternatives: -* Azure App Service (Linux): The Blink rendering engine is compatible with Azure App Service running on Linux. +*Azure App Service (Linux): The Blink rendering engine is compatible with Azure App Service running on Linux. -* Azure Functions (Linux): Linux-based Azure Functions can also utilize the Blink rendering engine for successful conversions. -* Azure App Service (Linux Docker): Deploying the application in a Linux-based Docker container offers another way to use Blink. +*Azure Functions (Linux): Linux-based Azure Functions can also utilize the Blink rendering engine for successful conversions. +*Azure App Service (Linux Docker): Deploying the application in a Linux-based Docker container offers another way to use Blink. |
| Reason | -+ |
This issue may occur due to one of the following reasons: -1. Missing required Linux dependencies -2. Missing Chromium dependency files -3. Lack of access permissions for the chrome and chrome-wrapper files +1.Missing required Linux dependencies +2.Missing Chromium dependency files +3.Lack of access permissions for the `chrome` and `chrome-wrapper` files |
To resolve the issue and ensure successful HTML to PDF conversion in Azure App Service (Linux), follow these steps: -1: Grant File Access Permissions +1: Grant File Access Permissions -Provide read, write, and execute permissions for the chrome and chrome-wrapper files located in the runtimes/linux/native directory. Use the following commands: +Provide read, write, and execute permissions for the `chrome` and `chrome-wrapper` files located in the `runtimes/linux/native` directory. Use the following commands: -{% highlight C# %} +{% highlight bash %} chmod +rwx chrome-wrapper chmod +rwx chrome {% endhighlight %} -2: Verify Chrome Dependency Packages +2: Verify Chrome Dependency Packages -Check if the necessary dependencies for Chromium are installed by running the following command in the runtimes/linux/native directory: +Check if the necessary dependencies for Chromium are installed by running the following command in the `runtimes/linux/native` directory: -{% highlight C# %} +{% highlight bash %} ldd chrome {% endhighlight %} -3: Install Required Dependencies +3: Install Required Dependencies -We can also perform HTML to PDF conversion in Azure App Service (Linux) by installing the required dependencies directly through SSH terminal. Use the following command: +You can also perform HTML to PDF conversion in Azure App Service (Linux) by installing the required dependencies directly through the SSH terminal. Use the following command: -{% highlight C# %} +{% highlight bash %} apt-get update && apt-get install -yq --no-install-recommends libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3 libgbm1 {% endhighlight %} -For more details to install the dependencies through SSH terminal window, refer to the documentation: -Convert HTML to PDF in Azure App Service on Linux| Syncfusion +For more details on installing the dependencies through the SSH terminal window, refer to the documentation: +Convert HTML to PDF in Azure App Service on Linux | Syncfusion |
@@ -1357,28 +1339,28 @@ For more details to install the dependencies through SSH terminal window, refer
|
| Reason | --User Interaction: The App service might start before installing the required prerequisites causing user interaction. + | +User Interaction: The App service might start before installing the required prerequisites, causing user interaction. | ||
| Solution |
-1.Script Execution at Startup -Copy the prerequisites script (dependenciesInstall.sh) into your application directory. +1.Script Execution at Startup +Copy the prerequisites script (`dependenciesInstall.sh`) into your application directory. Ensure it is configured to always be copied to the output directory during build/publish.
-2.Deploy to Azure App Service (Linux) +2.Deploy to Azure App Service (Linux) Publish your application to the Azure App Service. -3.Configure Startup Command +3.Configure Startup Command After deployment, go to the Azure portal configuration for your app service. In the Startup Command section, add: -{% highlight C# %} +{% highlight bash %} /home/site/wwwroot/dependenciesInstall.sh && dotnet YourApplicationName.dll @@ -1387,13 +1369,13 @@ In the Startup Command section, add:
-This ensures that your script runs to install necessary dependencies before the application launches. +This ensures that your script runs to install the necessary dependencies before the application launches. -4.Restart the App Service +4.Restart the App Service This will trigger the execution of your startup script, resolving installation and font issues. -5.Verification +5.Verification After the service restarts, try the conversion or operation again to ensure the issues are resolved. @@ -1411,18 +1393,18 @@ After the service restarts, try the conversion or operation again to ensure the | |||
| Reason | --Time64 transition: Ubuntu 24.04 adopted 64-bit timestamp support, renaming several libraries with the t64 suffix. libasound2 is now a virtual package provided by libasound2t64, so installing libasound2 directly fails. + | +Time64 transition: Ubuntu 24.04 adopted 64-bit timestamp support, renaming several libraries with the t64 suffix. `libasound2` is now a virtual package provided by `libasound2t64`, so installing `libasound2` directly fails. -Deprecated removal: libgconf-2-4 was deprecated and removed starting with Ubuntu 23.10 and is not available in 24.04 repositories. +Deprecated removal: `libgconf-2-4` was deprecated and removed starting with Ubuntu 23.10 and is not available in 24.04 repositories. | ||
| Solution | -Update the dependency installation script to use t64 packages and omit libgconf-2-4. The following command installs the supported libraries on Ubuntu 24.04: +Update the dependency installation script to use t64 packages and omit `libgconf-2-4`. The following command installs the supported libraries on Ubuntu 24.04: -{% highlight C# %} +{% highlight bash %} Run apt-get update && apt-get install -yq --no-install-recommends \ libasound2t64 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 \ @@ -1451,7 +1433,7 @@ After applying this change, all required dependencies are installed successfully | |||
| Reason | -The HTML to PDF converter launches the Blink rendering engine (Chromium headless browser) internally and converts the content at the specified URL or HTML string. If culture or language selection (such as switching from English to German) is implemented using cookies (e.g.,.AspNetCore.Culture), the URL itself does not change; only cookies control the localization. The converter does not automatically read or apply browser cookies set during user interaction, so the correct culture is not applied during rendering resulting in the default (often English) content in the PDF. + | The HTML to PDF converter launches the Blink rendering engine (Chromium headless browser) internally and converts the content at the specified URL or HTML string. If culture or language selection (such as switching from English to German) is implemented using cookies (e.g., .AspNetCore.Culture), the URL itself does not change; only cookies control the localization. The converter does not automatically read or apply browser cookies set during user interaction, so the correct culture is not applied during rendering, resulting in the default (often English) content in the PDF. | Solution | To ensure that the correct localized or culture-specific content appears in the generated PDF: -Set the required culture cookie explicitly using the Cookies property in BlinkConverterSettings before starting conversion. +Set the required culture cookie explicitly using the Cookies property in BlinkConverterSettings before starting the conversion. Example for setting German culture: -{% highlight C# %} +{% highlight c# %} HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); BlinkConverterSettings settings = new BlinkConverterSettings(); @@ -1480,9 +1462,9 @@ PdfDocument doc = htmlConverter.Convert(url); ## Due to insufficient permissions, we are unable to launch the Chromium process for conversion in Azure Function .NET 8.0 with premium plans. -The problem is limited to Azure Functions with premium plans in Net 8.0 version. To fix this, we can either manually install the necessary Chromium dependencies in the SSH portal or include the runtimes folder (Blink binaries) in the project location. +The problem is limited to Azure Functions with premium plans in .NET 8.0 version. To fix this, manually install the necessary Chromium dependencies in the SSH portal or include the runtimes folder (Blink binaries) in the project location. -Prerequisites dependencies: +**Prerequisites dependencies:** {% highlight bash %} @@ -1490,10 +1472,10 @@ apt-get update && apt-get install -yq --no-install-recommends libasound2 libatk1 {% endhighlight %} -N> We have option to exclude the default Blink binaries from the installation package. This will reduce the size of your deployment package in azure. Please refer to the code example below. +N> You have the option to exclude the default Blink binaries from the installation package. This reduces the size of your deployment package in Azure. Please refer to the code example below. {% tabs %} -{% highlight XAML %} +{% highlight xml %} |