Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

921494_ft1 Resolved the given feedback. #121

Merged
merged 1 commit into from
Dec 13, 2024
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 @@ -44,4 +44,6 @@

//Close the document.
loadedDocument.Close(true);
certificateStream.Dispose();
imageStream.Dispose();
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Step 4: **Add digital signature code**: Use the following code snippet in `Progr

// Close the document
loadedDocument.Close(true);
certificateStream.Dispose();
imageStream.Dispose();
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,28 @@ Step 3: **Include necessary namespaces**: Add the following namespaces in your `
Step 4: **Convert HTML to PDF**: Implement the following code in `Program.cs` to convert a website URL to a PDF file:

```csharp
// Initialize the HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();

// Convert a URL to a PDF document
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com");

// Create the FileStream to save the PDF document
FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);

// Save and close the PDF document
document.Save(fileStream);
document.Close(true);
//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");
}
//Assign Blink converter settings to HTML converter.
htmlConverter.ConverterSettings = blinkConverterSettings;
//Convert URL to PDF document.
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com");
//Create file stream.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document
document.Save(fileStream);
}
//Close the document.
document.Close(true);
```

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).
Expand Down
Loading