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

927661 Resolved the playground issues. #123

Merged
merged 1 commit into from
Dec 23, 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 @@ -17,7 +17,7 @@
javaScriptCollection.Add(javaScriptAction);

// Save the PDF document using a file stream.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.Write))
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
{
document.Save(fileStream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Syncfusion.Pdf;

//Load an existing PDF document using a file stream
using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument document = new PdfLoadedDocument(inputStream))
{
//Retrieve the JavaScript collection from the document
Expand All @@ -17,7 +17,7 @@
javaScriptCollection.Remove(javaScriptAction);

//Save the modified document using a file stream
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
document.Save(outputStream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Syncfusion.Pdf.Parsing;

//Load an existing PDF document using a file stream
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument document = new PdfLoadedDocument(fileStream))
{
//Retrieve the JavaScript collection from the loaded document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Syncfusion.Pdf.Parsing;

//Load the PDF document from a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(docStream))
{
//Create a PDF free text annotation
Expand All @@ -23,7 +23,7 @@
pdfLoadedDocument.Pages[0].Annotations.Add(freeText);

//Export annotations to the FDF format and save to a file using a file stream
using (FileStream fdfFileStream = new FileStream(Path.GetFullPath(@"Output\Output.fdf"), FileMode.Create, FileAccess.Write))
using (FileStream fdfFileStream = new FileStream(Path.GetFullPath(@"Output/Output.fdf"), FileMode.Create, FileAccess.Write))
{
pdfLoadedDocument.ExportAnnotations(fdfFileStream, AnnotationDataFormat.Fdf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Syncfusion.Pdf.Parsing;

//Load the PDF document from a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(docStream))
{
//Create a PDF free text annotation
Expand All @@ -22,7 +22,7 @@
pdfLoadedDocument.Pages[0].Annotations.Add(freeText);

//Export annotations to the JSON format and save to a file using a file stream
using (FileStream jsonFileStream = new FileStream(Path.GetFullPath(@"Output\Output.json"), FileMode.Create, FileAccess.Write))
using (FileStream jsonFileStream = new FileStream(Path.GetFullPath(@"Output/Output.json"), FileMode.Create, FileAccess.Write))
{
pdfLoadedDocument.ExportAnnotations(jsonFileStream, AnnotationDataFormat.Json);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Syncfusion.Pdf.Parsing;

//Load the PDF document from a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(docStream))
{
//Create a PDF free text annotation
Expand All @@ -22,7 +22,7 @@
pdfLoadedDocument.Pages[0].Annotations.Add(freeText);

//Export annotations to the XFDF format and save to a file using a file stream
using (FileStream xfdfFileStream = new FileStream(Path.GetFullPath(@"Output\Output.xfdf"), FileMode.Create, FileAccess.Write))
using (FileStream xfdfFileStream = new FileStream(Path.GetFullPath(@"Output/Output.xfdf"), FileMode.Create, FileAccess.Write))
{
pdfLoadedDocument.ExportAnnotations(xfdfFileStream, AnnotationDataFormat.XFdf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Syncfusion.Pdf.Parsing;

//Load the PDF document using a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
{
//Load the existing PDF document
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream))
Expand All @@ -17,7 +17,7 @@
loadedDocument.FlattenAnnotations(pdfLoadedAnnotationTypes);

//Save the flattened document using a file stream
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.Write))
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
{
loadedDocument.Save(outputStream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Syncfusion.Pdf.Parsing;

// Load an existing document from a file stream.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
{
PdfLoadedDocument doc = new PdfLoadedDocument(fileStream);
// Load an existing combo box field by its name.
Expand All @@ -11,7 +11,7 @@
comboField.TextAlignment = PdfTextAlignment.Center;

// Save the updated document to a file stream.
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.Write))
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
{
doc.Save(outputStream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//Define the bounds for the signature (position and size on the page).
signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(200, 100));
//Save the document to a file using a file stream.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
document.Save(fileStream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
// Initialize BlinkConverterSettings to configure the Blink rendering engine.
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
//Set command line arugument to run without the sandbox.
blinkConverterSettings.CommandLineArguments.Add("--no-sandbox");
blinkConverterSettings.CommandLineArguments.Add("--disable-setuid-sandbox");
}

// Enables automatic scaling to adjust the HTML content to fit the PDF's dimensions.
blinkConverterSettings.EnableAutoScaling = true;

// Assigns the Blink settings to the HTML to PDF converter.
htmlConverter.ConverterSettings = blinkConverterSettings;
// Converts the HTML file to a PDF document, using the path of the HTML file.
PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data\Input.html"));
PdfDocument document = htmlConverter.Convert(Path.GetFullPath(@"Data/Input.html"));
// Save the generated PDF document to a specified output file.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create))
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create))
{
document.Save(fileStream);
}
Expand Down
Loading