Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ You can set the runtimes folder path explicitly in BlinkPath property in BlinkCo
<br/><br/>
Ex path: <i>C:\HtmlConversion\HTMl-to-PDF\HTMl-to-PDF\bin\Debug\net7.0\runtimes\win-x64\native\</i>
<br/><br/>
{% highlight c# tabtitle="C# [Cross-platform]" %}
{% tabs %}
{% highlight C# %}

//Initialize the HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
Expand All @@ -52,6 +53,7 @@ document.Save(fileStream);
document.Close(true);

{% endhighlight %}
{% endtabs %}
</td>
</tr>

Expand Down Expand Up @@ -137,13 +139,15 @@ Also, please add the following command line arguments in our converter setting.
<table>
<tr>
<td>
{% 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 %}
</td>
</tr>
</table>
Expand Down Expand Up @@ -247,12 +251,14 @@ blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox");
</th>
<td>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.
<br><br/>
{% highlight %}
{% tabs %}
{% highlight C# tabtitle="C#" %}

BlinkConverterSettings settings = new BlinkConverterSettings();
settings.TempPath = "D://MyProject//bin";

{% endhighlight %}
{% endtabs %}
</td>
</tr>

Expand Down Expand Up @@ -330,7 +336,8 @@ Check the HTML file or URL is rendered properly in Chrome browser's print previe
<br><br/>
<img src="htmlconversion_images/Troubleshooting_webpage_exception_Linux.png" alt="ExcludeAssets">
<br><br/>
{% highlight %}
{% tabs %}
{% highlight C# tabtitle="C#" %}

COPY . /app
WORKDIR /app
Expand All @@ -339,6 +346,7 @@ RUN chmod +x /app/runtimes/linux/native/chrome && \
chmod +x /app/runtimes/linux/native/chrome-wrapper

{% endhighlight %}
{% endtabs %}
</td>
</tr>
</table>
Expand All @@ -362,12 +370,14 @@ RUN chmod +x /app/runtimes/linux/native/chrome && \
</th>
<td>To overcome this issue, add suitable delay for the conversion using the <a href="https://help.syncfusion.com/cr/file-formats/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_AdditionalDelay">AdditionalDelay</a> property of the HTMLConverter.
<br><br/>
{% highlight %}
{% tabs %}
{% highlight C# tabtitle="C#" %}

BlinkConverterSettings settings = new BlinkConverterSettings();
settings.AdditionalDelay = 4000;

{% endhighlight %}
{% endtabs %}
</td>
</tr>

Expand Down Expand Up @@ -431,12 +441,14 @@ Refer to this <a href="https://www.syncfusion.com/kb/10258/how-to-convert-html-t
</th>
<td>You can able to bypass the invalid SSL certificate errors using the command line arguments property of Blink converter settings.
<br><br/>
{% highlight %}
{% tabs %}
{% highlight C# tabtitle="C#" %}

BlinkConverterSettings settings = new BlinkConverterSettings();
settings.CommandLineArguments.Add("--ignore-certificate-errors");

{% endhighlight %}
{% endtabs %}
</td>
</tr>
</table>
Expand All @@ -461,13 +473,15 @@ settings.CommandLineArguments.Add("--ignore-certificate-errors");
</th>
<td>We can resolve this permission related failure in the Blink rendering engine using below command line arguments in our converter settings.
<br><br/>
{% 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 %}
</td>
</tr>
</table>
Expand Down Expand Up @@ -591,7 +605,7 @@ To resolve this issue, we can install the chromium using the docker file and set
Docker File:<br><br>
{% tabs %}

{% highlight %}
{% highlight C# tabtitle="C#" %}

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base

Expand All @@ -615,9 +629,12 @@ Docker File:<br><br>

{% endhighlight %}

{% endtabs %}

Code snippet:
{% tabs %}

{% highlight %}
{% highlight C# tabtitle="C#" %}

BlinkConverterSettings settings = new BlinkConverterSettings();

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down
63 changes: 39 additions & 24 deletions File-Formats/PDF/Working-with-OCR/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ keywords: Assemblies
<td>
Set proper tesseract binaries and tessdata folder with all files and inner folders. The tessdata folder name is case-sensitive and should not change.
<br/><br/>
{% 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/");
Expand All @@ -34,6 +35,7 @@ OCRProcessor processor = new OCRProcessor(@"TesseractBinaries/");
processor.PerformOCR(lDoc, @"TessData/");

{% endhighlight %}
{% endtabs %}
</td>
</tr>
<tr>
Expand Down Expand Up @@ -180,36 +182,41 @@ By using the best tessdata, we can improve the OCR results. For more information
<br><br/>
1.Execute the following command to install Tesserat 5.
<br><br/>
{% highlight %}
{% tabs %}
{% highlight C# %}

brew install tesseract

{% endhighlight %}

{% endtabs %}
<br><br/>
If the "brew" is not installed on your machine, you can install it using the following command.
<br><br/>
{% highlight %}
{% tabs %}
{% highlight C# %}

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

{% endhighlight %}

{% endtabs %}
<br><br/>

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:
<br><br/>
{% 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 %}
<br><br/>

3.Add the TessDataPath from bin folder. Refer to the example code below:
<br></br>
{% 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"))
{
Expand All @@ -232,6 +239,7 @@ using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract
}

{% endhighlight %}
{% endtabs %}
</td>
</tr>
</table>
Expand All @@ -253,38 +261,45 @@ using (OCRProcessor processor = new OCRProcessor("/opt/homebrew/Cellar/tesseract
<br><br/>
1. Install the leptonica.
<br>
{% highlight %}
{% tabs %}
{% highlight C# %}

sudo apt-get install libleptonica-dev

{% endhighlight %}
{% endtabs %}
<br><br>
<img src="OCR-Images/Install-leptonica.png">
<br><br>
2.Install the tesseract.
<br>

{% highlight %}
{% tabs %}
{% highlight C# %}

sudo apt-get install tesseract-ocr-eng

{% endhighlight %}
{% endtabs %}
<br><br>
<img src="OCR-Images/Install-tesseract.png">
<br><br>
3. Copy the binaries (liblept.so and libtesseract.so) to the missing files exception folder in the project location.
<br>
{% 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 %}
<br>
{% 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 %}
<br/>
</td>
</tr>
Expand All @@ -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 %}
</td>
</tr>
</table>