Skip to content

Commit 1107cdf

Browse files
committed
Merge branch '986214-ug' of https://github.com/syncfusion-content/document-processing-docs into 986214-ug
2 parents c398463 + 4d0432f commit 1107cdf

File tree

308 files changed

+14045
-7821
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+14045
-7821
lines changed

Document-Processing-toc.html

Lines changed: 137 additions & 101 deletions
Large diffs are not rendered by default.

Document-Processing/PDF/Conversions/HTML-To-PDF/NET/Convert-HTML-to-PDF-in-Azure-Functions-Linux.md

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,62 @@ Step 3: Select the function worker as .NET 8.0 isolated (Long-term support), and
2424
![Convert HTMLToPDF Azure Functions Step3](Azure_images\Azure-function-linux\AzureFunctions3.png)
2525

2626
Step 4: Install the [Syncfusion.HtmlToPdfConverter.Net.Linux](https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Linux/) NuGet package as a reference to your .NET Core application [NuGet.org](https://www.nuget.org/).
27-
![Convert HTMLToPDF Azure Functions Step3](Azure_images\Azure-function-linux\Nuget-package.png)
27+
![Convert HTMLToPDF Azure Functions Step4](Azure_images\Azure-function-linux\Nuget-package.png)
2828

2929
N> Starting with v16.2.0.x, if you reference Syncfusion<sup>&reg;</sup> assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion<sup>&reg;</sup> license key in your application to use our components.
3030

31-
Step 5: Include the following namespaces in Function1.cs file.
31+
32+
Step 5: Create a shell file with the below commands in the project and name it as dependenciesInstall.sh. In this article, these steps have been followed to install dependencies packages.
33+
34+
{% highlight bash tabtitle="Shell" %}
35+
36+
echo "Starting dependencies installation script..."
37+
38+
39+
if ! command -v rsync &> /dev/null; then
40+
echo "rsync could not be found, installing..."
41+
apt-get update && apt-get install -yq rsync
42+
fi
43+
44+
FILE_PATH="/home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu/libnss3.so"
45+
if [ -f "$FILE_PATH" ]; then
46+
echo "Dependencies file exists."
47+
PACKAGE_USR="/home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu"
48+
if [ -d "$PACKAGE_USR" ]; then
49+
echo "Copying user libraries..."
50+
rsync -av --update /home/site/wwwroot/Package/usr/lib/ /usr/lib/
51+
echo "Copied successfully..."
52+
fi
53+
else
54+
echo "Package directory does not exist. Installing dependencies..."
55+
apt-get update && apt-get install -yq --no-install-recommends \
56+
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 \
57+
libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
58+
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 \
59+
libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 \
60+
libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3 libgbm1
61+
62+
mkdir -p /home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu
63+
mkdir -p /home/site/wwwroot/Package/lib/x86_64-linux-gnu
64+
65+
PACKAGE_USR="/home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu"
66+
if [ -d "$PACKAGE_USR" ]; then
67+
echo "Copying user libraries to package..."
68+
rsync -av /usr/lib/x86_64-linux-gnu/ /home/site/wwwroot/Package/usr/lib/x86_64-linux-gnu
69+
fi
70+
fi
71+
72+
echo "Dependencies installation script completed."
73+
74+
{% endhighlight %}
75+
76+
![Convert HTMLToPDF Azure Functions Step5](htmlconversion_images\ShellCommand.png)
77+
78+
Step 6: Set Copy to Output Directory as “Copy if newer” to the dependenciesInstall.sh file.
79+
80+
![Convert HTMLToPDF Azure Functions Step6](htmlconversion_images\CopyToNewer.png)
81+
82+
Step 7: Include the following namespaces in Function1.cs file.
3283

3384
{% highlight c# tabtitle="C#" %}
3485

@@ -39,7 +90,7 @@ Step 5: Include the following namespaces in Function1.cs file.
3990

4091
{% endhighlight %}
4192

42-
Step 6: This Azure Function converts HTML to PDF using HTTP triggers. It handles GET/POST requests, processes the HTML, and returns a PDF response.
93+
Step 8: This Azure Function converts HTML to PDF using HTTP triggers. It handles GET/POST requests, processes the HTML, and returns a PDF response.
4394

4495
{% highlight c# tabtitle="C#" %}
4596

@@ -67,7 +118,7 @@ Step 6: This Azure Function converts HTML to PDF using HTTP triggers. It handles
67118

68119
{% endhighlight %}
69120

70-
step 7: Use the following code example in the HtmlToPdfConvert method to convert HTML to a PDF document using the [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_) method in the [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class. The Blink command line arguments are configured based on the given [CommandLineArguments](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_CommandLineArguments) property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class.
121+
step 9: Use the following code example in the HtmlToPdfConvert method to convert HTML to a PDF document using the [Convert](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html#Syncfusion_HtmlConverter_HtmlToPdfConverter_Convert_System_String_) method in the [HtmlToPdfConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.HtmlToPdfConverter.html) class. The Blink command line arguments are configured based on the given [CommandLineArguments](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html#Syncfusion_HtmlConverter_BlinkConverterSettings_CommandLineArguments) property of the [BlinkConverterSettings](https://help.syncfusion.com/cr/document-processing/Syncfusion.HtmlConverter.BlinkConverterSettings.html) class.
71122

72123
{% highlight c# tabtitle="C#" %}
73124

@@ -99,6 +150,7 @@ public byte[] HtmlToPdfConvert(string htmlText)
99150
Bottom = 20
100151
}
101152
};
153+
102154
htmlConverter.ConverterSettings = settings;
103155

104156
// Convert HTML to PDF
@@ -127,7 +179,7 @@ N> settings.CommandLineArguments.Add("--disable-setuid-sandbox");
127179
N> ```
128180
N> These arguments are only required when using **older versions** of the library that depend on Blink in sandbox-restricted environments.
129181

130-
Step 8: This code is designed to ensure that the necessary Linux packages for HTML to PDF conversion are installed if the operating system is Linux. It adjusts file permissions and executes a shell script to carry out the installation.
182+
Step 10: This code is designed to ensure that the necessary Linux packages for HTML to PDF conversion are installed if the operating system is Linux. It adjusts file permissions and executes a shell script to carry out the installation.
131183

132184
{% highlight c# tabtitle="C#" %}
133185

@@ -195,7 +247,7 @@ private static void InstallLinuxPackages()
195247
{% endhighlight %}
196248

197249

198-
Step 9: Add the following helper methods to copy and set permission to the BlinkBinariesLinux folder.
250+
Step 11: Add the following helper methods to copy and set permission to the BlinkBinariesLinux folder.
199251

200252
{% highlight c# tabtitle="C#" %}
201253

@@ -257,7 +309,7 @@ private static void SetExecutablePermission(string tempBlinkDir)
257309

258310
{% endhighlight %}
259311

260-
Step 10: Include the below enum in the Function1.cs file.
312+
Step 12: Include the below enum in the Function1.cs file.
261313

262314
{% highlight c# tabtitle="C#" %}
263315

@@ -318,4 +370,5 @@ An online sample link to [convert HTML to PDF document](https://ej2.syncfusion.c
318370

319371
Click [here](https://www.syncfusion.com/document-processing/pdf-framework/net-core/html-to-pdf) to explore the rich set of Syncfusion<sup>&reg;</sup> HTML to PDF converter library features.
320372

321-
An online sample link to [convert HTML to PDF document](https://ej2.syncfusion.com/aspnetcore/PDF/HtmltoPDF#/material3) in ASP.NET Core.
373+
374+
An online sample link to [convert HTML to PDF document](https://ej2.syncfusion.com/aspnetcore/PDF/HtmltoPDF#/material3) in ASP.NET Core.
52.5 KB
Loading
36.4 KB
Loading

Document-Processing/PDF/Conversions/HTML-To-PDF/NET/troubleshooting.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,5 +1572,26 @@ N> We have option to exclude the default Blink binaries from the installation pa
15721572

15731573
</PackageReference>
15741574

1575+
{% endhighlight %}
1576+
{% endtabs %}
1577+
1578+
## How to Exclude BlinkBinaries or Runtime Files in Build or Deployment
1579+
1580+
The runtime files, or blink binaries, will be copied into a bin or published folder while building and publishing the application.
1581+
By including the <ExcludeAssets>native</ExcludeAssets> option in the package reference of the csproj file, you can exclude the runtime files or blink binaries from being copied into the bin or publish folder while building and publishing the application. But you need to place the BlinkBinaries in the server disk and set the BlinkPath in the BlinkConverterSettings to perform the conversion.
1582+
1583+
N> Using this approach, you can reduce the deployment size on your own servers.
1584+
1585+
Refer to the following package reference:
1586+
1587+
{% tabs %}
1588+
{% highlight C# %}
1589+
1590+
<ItemGroup>
1591+
<PackageReference Include="Syncfusion.HtmlToPdfConverter.Net.Windows" Version="31.1.23">
1592+
<ExcludeAssets>native</ExcludeAssets>
1593+
</PackageReference>
1594+
</ItemGroup>
1595+
15751596
{% endhighlight %}
15761597
{% endtabs %}

Document-Processing/PDF/PDF-Library/NET/Split-Documents.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ Refer to the following code example to split a range of pages.
8282
{% tabs %}
8383
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Split%20PDFs/Split-a-Range-of-Pages/.NET/Split-a-Range-of-Pages/Program.cs" %}
8484

85+
{% raw %}
86+
8587
using Syncfusion.Pdf.Parsing;
8688

8789
//Create the values.
@@ -95,10 +97,13 @@ loadedDocument.SplitByRanges(destinationFilePattern, values);
9597
//close the document
9698
loadedDocument.Close(true);
9799

100+
{% endraw %}
98101
{% endhighlight %}
99102

100103
{% highlight c# tabtitle="C# [Windows-specific]" %}
101104

105+
{% raw %}
106+
102107
using Syncfusion.Pdf.Parsing;
103108

104109
//Create the values.
@@ -112,14 +117,16 @@ loadedDocument.SplitByRanges(destinationFilePattern, values);
112117
//close the document
113118
loadedDocument.Close(true);
114119

120+
{% endraw %}
115121
{% endhighlight %}
116122

117123
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
124+
{% raw %}
118125

119126
Imports Syncfusion.Pdf.Parsing
120127

121128
'Create the values.
122-
Dim values As Integer(,) = New Integer(,) {{2, 5},{8, 10}}
129+
Dim values As Integer(,) = New Integer(,) {{2, 5}, {8, 10}}
123130
'Load the PDF document.
124131
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
125132
'Set a output path
@@ -128,7 +135,7 @@ Const destinationFilePattern As String = "Output" + "{0}.pdf"
128135
loadedDocument.SplitByRanges(destinationFilePattern, values)
129136
'Close the document.
130137
loadedDocument.Close(True)
131-
138+
{% endraw %}
132139
{% endhighlight %}
133140

134141
{% endtabs %}
@@ -313,6 +320,7 @@ The Syncfusion<sup>&reg;</sup> PDF library enables the splitting of PDF document
313320

314321
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Split%20PDFs/Remove-Unused-Resources-when-Splitting-PDF-Documents/.NET/Remove-Unused-Resources-when-Splitting-PDF-Documents/Program.cs" %}
315322

323+
{% raw %}
316324
using Syncfusion.Pdf;
317325
using Syncfusion.Pdf.Parsing;
318326

@@ -331,9 +339,11 @@ loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions);
331339
//Close the document.
332340
loadedDocument.Close(true);
333341

342+
{% endraw %}
334343
{% endhighlight %}
335344

336345
{% highlight c# tabtitle="C# [Windows-specific]" %}
346+
{% raw %}
337347

338348
using Syncfusion.Pdf;
339349
using Syncfusion.Pdf.Parsing;
@@ -353,9 +363,11 @@ loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions);
353363
//Close the document.
354364
loadedDocument.Close(true);
355365

366+
{% endraw %}
356367
{% endhighlight %}
357368

358369
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
370+
{% raw %}
359371

360372
Imports Syncfusion.Pdf
361373
Imports Syncfusion.Pdf.Parsing
@@ -375,7 +387,7 @@ loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions)
375387

376388
'Close the document.
377389
loadedDocument.Close(True)
378-
390+
{% endraw %}
379391
{% endhighlight %}
380392

381393
{% endtabs %}
@@ -390,7 +402,7 @@ The Syncfusion<sup>&reg;</sup> PDF library enables the splitting of PDF document
390402
{% tabs %}
391403

392404
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Split%20PDFs/Import-tagged-structure-when-splitting-PDF-documents/.NET/Import-tagged-structure-when-splitting-PDF-documents/Program.cs" %}
393-
405+
{% raw %}
394406
using Syncfusion.Pdf;
395407
using Syncfusion.Pdf.Parsing;
396408

@@ -409,11 +421,11 @@ loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions);
409421

410422
//Close the document.
411423
loadedDocument.Close(true);
412-
424+
{% endraw %}
413425
{% endhighlight %}
414426

415427
{% highlight c# tabtitle="C# [Windows-specific]" %}
416-
428+
{% raw %}
417429
using Syncfusion.Pdf;
418430
using Syncfusion.Pdf.Parsing;
419431

@@ -432,11 +444,11 @@ loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions);
432444

433445
//Close the document.
434446
loadedDocument.Close(true);
435-
447+
{% endraw %}
436448
{% endhighlight %}
437449

438450
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
439-
451+
{% raw %}
440452
Imports Syncfusion.Pdf
441453
Imports Syncfusion.Pdf.Parsing
442454

@@ -455,7 +467,7 @@ loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions)
455467

456468
'Close the document.
457469
loadedDocument.Close(True)
458-
470+
{% endraw %}
459471
{% endhighlight %}
460472

461473
{% endtabs %}

0 commit comments

Comments
 (0)