From 861e8014468a8bd3313917aefbca3027deae7c5c Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Wed, 20 Mar 2024 11:28:09 +0530 Subject: [PATCH] 875092: HTML to PDF converter feature samples. --- .../.NET/Accessible PDF.sln | 25 ++++++++++++ .../.NET/Accessible PDF/Accessible PDF.csproj | 15 +++++++ .../.NET/Accessible PDF/Input.html | 13 +++++++ .../.NET/Accessible PDF/Program.cs | 18 +++++++++ .../.NET/Image_Background_In_HTML_to_PDF.sln | 25 ++++++++++++ .../Image_Background_In_HTML_to_PDF.csproj | 15 +++++++ .../Input.html | 39 +++++++++++++++++++ .../Program.cs | 25 ++++++++++++ 8 files changed, 175 insertions(+) create mode 100644 HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF.sln create mode 100644 HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Accessible PDF.csproj create mode 100644 HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Input.html create mode 100644 HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs create mode 100644 HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF.sln create mode 100644 HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Image_Background_In_HTML_to_PDF.csproj create mode 100644 HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Input.html create mode 100644 HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs diff --git a/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF.sln b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF.sln new file mode 100644 index 00000000..f869891a --- /dev/null +++ b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accessible PDF", "Accessible PDF\Accessible PDF.csproj", "{9D4BF26B-45EF-428A-8C6F-63E9ECC5039F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9D4BF26B-45EF-428A-8C6F-63E9ECC5039F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D4BF26B-45EF-428A-8C6F-63E9ECC5039F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D4BF26B-45EF-428A-8C6F-63E9ECC5039F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D4BF26B-45EF-428A-8C6F-63E9ECC5039F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1CE4DA91-A9DA-4279-98D3-E2F732A65DC8} + EndGlobalSection +EndGlobal diff --git a/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Accessible PDF.csproj b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Accessible PDF.csproj new file mode 100644 index 00000000..c069ac48 --- /dev/null +++ b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Accessible PDF.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Accessible_PDF + enable + enable + + + + + + + diff --git a/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Input.html b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Input.html new file mode 100644 index 00000000..ae2b7842 --- /dev/null +++ b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Input.html @@ -0,0 +1,13 @@ + + + + +

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
Heading 6
+ + + diff --git a/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs new file mode 100644 index 00000000..7879bd98 --- /dev/null +++ b/HTML to PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible PDF/Program.cs @@ -0,0 +1,18 @@ +using Syncfusion.HtmlConverter; +using Syncfusion.Pdf; + +//Initialize HTML to PDF converter. +HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); +//Initialize the BlinkConverterSettings. +BlinkConverterSettings settings = new BlinkConverterSettings(); +//Set true to enable the accessibility tags in PDF generation. +settings.EnableAccessibilityTags = true; +//Assign the BlinkConverterSettings to the ConverterSettings property of HtmlToPdfConverter. +htmlConverter.ConverterSettings = settings; +//Convert URL to PDF. +PdfDocument document = htmlConverter.Convert("file:///D:/PDF-Examples/HTML%20to%20PDF/Blink/Accessible_PDF_In_HTML_to_PDF/.NET/Accessible%20PDF/Input.html"); +//Save and close 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); diff --git a/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF.sln b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF.sln new file mode 100644 index 00000000..64563462 --- /dev/null +++ b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Image_Background_In_HTML_to_PDF", "Image_Background_In_HTML_to_PDF\Image_Background_In_HTML_to_PDF.csproj", "{56A42FB1-CF8D-4137-9E24-B33FFDC7D168}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {56A42FB1-CF8D-4137-9E24-B33FFDC7D168}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {56A42FB1-CF8D-4137-9E24-B33FFDC7D168}.Debug|Any CPU.Build.0 = Debug|Any CPU + {56A42FB1-CF8D-4137-9E24-B33FFDC7D168}.Release|Any CPU.ActiveCfg = Release|Any CPU + {56A42FB1-CF8D-4137-9E24-B33FFDC7D168}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AD1CA070-D4C9-4ADD-B6CB-E104FAA503A6} + EndGlobalSection +EndGlobal diff --git a/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Image_Background_In_HTML_to_PDF.csproj b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Image_Background_In_HTML_to_PDF.csproj new file mode 100644 index 00000000..4f18673d --- /dev/null +++ b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Image_Background_In_HTML_to_PDF.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + diff --git a/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Input.html b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Input.html new file mode 100644 index 00000000..792cf4dd --- /dev/null +++ b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Input.html @@ -0,0 +1,39 @@ + + + + + + + + + +
{{__EntryNumber__}}Opening Views
+
+
+

RealWorld has several core views and a basic browser interface. All core features can be accessed by the Shortcuts window displayed on the left hand side of the RealWorld user interface.

+ +

To open, simply click the corresponding node in the shortcuts treeview. If the window is not currently open, or has been closed, it will be opened. If it is already open, then it will be activated.

+ +

Clicking a internet shortcut will open/activate the browser window and display the specified page. Only one browser window can be open at any one time.

+ +

 

+ +

Displaying a list of open windows

+ +
    +
  • Open the Window menu. A list of the first 10 open windows will be listed.
  • +
+ +

- or -

+ +
    +
  1. Open the Window menu and click More Windows.
  2. + +
  3. The dialog displayed will list all open windows, allowing you to easily view and switch between windows
  4. +
+
+
+ + \ No newline at end of file diff --git a/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs new file mode 100644 index 00000000..ca004f33 --- /dev/null +++ b/HTML to PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Program.cs @@ -0,0 +1,25 @@ + +using Syncfusion.Drawing; +using Syncfusion.HtmlConverter; + +//Initialize HTML to PDF converter. +HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); + +//Initialize the BlinkConverterSettings +BlinkConverterSettings settings = new BlinkConverterSettings(); + +//Set the Image Background color. +settings.ImageBackgroundColor = Color.Transparent; + +//Assign the BlinkConverterSettings to the ConverterSettings property of HtmlToPdfConverter. +htmlConverter.ConverterSettings = settings; + +//Convert HTML to Image +Image image = htmlConverter.ConvertToImage("file:///D:/PDF-Examples/HTML%20to%20PDF/Blink/Image_Background_In_HTML_to_PDF/.NET/Image_Background_In_HTML_to_PDF/Input.html"); + +//Save the Image. +byte[] imageByte = image.ImageData; + +File.WriteAllBytes("Output.png", imageByte); + +