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
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@

using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
using System.Runtime.InteropServices;

//Initialize HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Create blink converter settings
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
//Set command line arguments to run without the sandbox.
blinkConverterSettings.CommandLineArguments.Add("--no-sandbox");
blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox");
blinkConverterSettings.AdditionalDelay = 0;
}

//Assign Blink converter settings to HTML converter.
htmlConverter.ConverterSettings = blinkConverterSettings;
//Convert URL to PDF document.
Expand All @@ -26,4 +19,4 @@
document.Save(fileStream);
}
//Close the document.
document.Close(true);
document.Close(true);
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Step 3: **Include necessary namespaces**: Add the following namespaces in your `
```csharp
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
using System.Runtime.InteropServices;
```

Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to convert a website URL to a PDF file:
Expand All @@ -25,12 +24,6 @@ Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Create blink converter settings
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
//Set command line arguments to run without the sandbox.
blinkConverterSettings.CommandLineArguments.Add("--no-sandbox");
blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox");
}
//Assign Blink converter settings to HTML converter.
htmlConverter.ConverterSettings = blinkConverterSettings;
//Convert URL to PDF document.
Expand All @@ -47,4 +40,4 @@ Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to

You can download a complete working sample from the [GitHub repository](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/Convert-website-URL-to-PDF-document).

More information about the HTML to PDF conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features) section.
More information about the HTML to PDF conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/features) section.
Loading