diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md index a6476bcee..fd2bcbfeb 100644 --- a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md +++ b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md @@ -34,7 +34,8 @@ You can set the runtimes folder path explicitly in BlinkPath property in BlinkCo

Ex path: C:\HtmlConversion\HTMl-to-PDF\HTMl-to-PDF\bin\Debug\net7.0\runtimes\win-x64\native\

-{% highlight c# tabtitle="C# [Cross-platform]" %} +{% tabs %} +{% highlight C# %} //Initialize the HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); @@ -52,6 +53,7 @@ document.Save(fileStream); document.Close(true); {% endhighlight %} +{% endtabs %} @@ -137,13 +139,15 @@ Also, please add the following command line arguments in our converter setting.
-{% highlight %} +{% tabs %} +{% highlight C# tabtitle="C#" %} //Set command line arguments to run without sandbox. blinkConverterSettings.CommandLineArguments.Add("--no-sandbox"); blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); {% endhighlight %} +{% endtabs %}
@@ -247,12 +251,14 @@ blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); To overcome the exception, you can add read, write, and execute permissions for the temporary folder. Refer to the following code sample to set the temp folder.

-{% highlight %} +{% tabs %} +{% highlight C# tabtitle="C#" %} BlinkConverterSettings settings = new BlinkConverterSettings(); settings.TempPath = "D://MyProject//bin"; {% endhighlight %} +{% endtabs %} @@ -330,7 +336,8 @@ Check the HTML file or URL is rendered properly in Chrome browser's print previe

ExcludeAssets

-{% highlight %} +{% tabs %} +{% highlight C# tabtitle="C#" %} COPY . /app WORKDIR /app @@ -339,6 +346,7 @@ RUN chmod +x /app/runtimes/linux/native/chrome && \ chmod +x /app/runtimes/linux/native/chrome-wrapper {% endhighlight %} +{% endtabs %} @@ -362,12 +370,14 @@ RUN chmod +x /app/runtimes/linux/native/chrome && \ To overcome this issue, add suitable delay for the conversion using the AdditionalDelay property of the HTMLConverter.

-{% highlight %} +{% tabs %} +{% highlight C# tabtitle="C#" %} BlinkConverterSettings settings = new BlinkConverterSettings(); settings.AdditionalDelay = 4000; {% endhighlight %} +{% endtabs %} @@ -431,12 +441,14 @@ Refer to this @@ -461,13 +473,15 @@ settings.CommandLineArguments.Add("--ignore-certificate-errors"); We can resolve this permission related failure in the Blink rendering engine using below command line arguments in our converter settings.

-{% highlight %} +{% tabs %} +{% highlight C# tabtitle="C#" %} //Set command line arguments to run without sandbox. blinkConverterSettings.CommandLineArguments.Add("--no-sandbox"); blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox"); {% endhighlight %} +{% endtabs %} @@ -591,7 +605,7 @@ To resolve this issue, we can install the chromium using the docker file and set Docker File:

{% tabs %} -{% highlight %} +{% highlight C# tabtitle="C#" %} FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base @@ -615,9 +629,12 @@ Docker File:

{% endhighlight %} +{% endtabs %} + Code snippet: +{% tabs %} -{% highlight %} +{% highlight C# tabtitle="C#" %} BlinkConverterSettings settings = new BlinkConverterSettings(); @@ -657,7 +674,7 @@ To resolve this issue, we can add inline styles in element. However, we have att {% tabs %} -{% highlight c# tabtitle="C# [Cross-platform]" %} +{% highlight C# tabtitle="C#" %} HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Initialize blink converter settings. @@ -698,7 +715,7 @@ You can downloaded a complete working sample from [GitHub](https://github.com/Sy {% tabs %} -{% highlight %} +{% highlight C# %} //Set command line arguments to run without the sandbox. diff --git a/File-Formats/PDF/Working-with-OCR/Troubleshooting.md b/File-Formats/PDF/Working-with-OCR/Troubleshooting.md index dde43980f..3fad7b8a1 100644 --- a/File-Formats/PDF/Working-with-OCR/Troubleshooting.md +++ b/File-Formats/PDF/Working-with-OCR/Troubleshooting.md @@ -25,7 +25,8 @@ keywords: Assemblies Set proper tesseract binaries and tessdata folder with all files and inner folders. The tessdata folder name is case-sensitive and should not change.

-{% highlight c# tabtitle="C# [Cross-platform]" %} +{% tabs %} +{% highlight C# tabtitle="C# [Cross-platform]" %} //TesseractBinaries - path of the folder tesseract binaries. OCRProcessor processor = new OCRProcessor(@"TesseractBinaries/"); @@ -34,6 +35,7 @@ OCRProcessor processor = new OCRProcessor(@"TesseractBinaries/"); processor.PerformOCR(lDoc, @"TessData/"); {% endhighlight %} +{% endtabs %} @@ -180,36 +182,41 @@ By using the best tessdata, we can improve the OCR results. For more information

1.Execute the following command to install Tesserat 5.

-{% highlight %} +{% tabs %} +{% highlight C# %} brew install tesseract {% endhighlight %} - +{% endtabs %}

If the "brew" is not installed on your machine, you can install it using the following command.

-{% highlight %} +{% tabs %} +{% highlight C# %} /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" {% endhighlight %} - +{% endtabs %}

2.Once Tesseract 5 is successfully installed, you can configure the path to the latest binaries by copying the location of the Tesseract folder and setting it as the Tesseract binaries path when setting up the OCR processor. Refer to the example code below:

-{% highlight %} +{% tabs %} +{% highlight C# %} //Initialize the OCR processor by providing the path of tesseract binaries. using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract/5.3.2/lib")) {% endhighlight %} +{% endtabs %}

3.Add the TessDataPath from bin folder. Refer to the example code below:

-{% highlight c# tabtitle="C# [Cross-platform]" %} +{% tabs %} +{% highlight C# tabtitle="C# [Cross-platform]" %} using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract/5.3.2/lib")) { @@ -232,6 +239,7 @@ using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract } {% endhighlight %} +{% endtabs %} @@ -253,38 +261,45 @@ using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract

1. Install the leptonica.
-{% highlight %} +{% tabs %} +{% highlight C# %} sudo apt-get install libleptonica-dev {% endhighlight %} +{% endtabs %}



2.Install the tesseract.
- -{% highlight %} +{% tabs %} +{% highlight C# %} sudo apt-get install tesseract-ocr-eng {% endhighlight %} +{% endtabs %}



3. Copy the binaries (liblept.so and libtesseract.so) to the missing files exception folder in the project location.
-{% highlight c# tabtitle="C#" %} +{% tabs %} +{% highlight C# %} cp /usr/lib/x86_64-linux-gnu/liblept.so /home/syncfusion/linuxdockersample/linuxdockersample/bin/Debug/net7.0/liblept1753.so {% endhighlight %} +{% endtabs %}
-{% highlight %} +{% tabs %} +{% highlight C# %} cp /usr/lib/x86_64-linux-gnu/libtesseract.so.4 /home/syncfusion/linuxdockersample/linuxdockersample/bin/Debug/net7.0/libSyncfusionTesseract.so {% endhighlight %} +{% endtabs %}
@@ -308,39 +323,39 @@ cp /usr/lib/x86_64-linux-gnu/libtesseract.so.4 /home/syncfusion/linuxdockersampl To resolve this problem, you should install all required dependencies in your Linux machine. Refer to the following steps to installing the missing dependencies. Step 1: Execute the following command in terminal window to check dependencies are installed properly. - -{% highlight %} +{% tabs %} +{% highlight C# %} ldd liblept1753.so ldd libSyncfusionTesseract.so {% endhighlight %} - +{% endtabs %} Run the following commands in terminal Step 1: - -{% highlight %} +{% tabs %} +{% highlight C# %} sudo apt-get install libleptonica-dev libjpeg62 {% endhighlight %} - +{% endtabs %} Step 2: - -{% highlight %} +{% tabs %} +{% highlight C# %} ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.6 /usr/lib/x86_64-linux-gnu/libtiff.so.5 {% endhighlight %} - +{% endtabs %} Step 3: - -{% highlight %} +{% tabs %} +{% highlight C# %} ln -s /lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so {% endhighlight %} - +{% endtabs %} \ No newline at end of file