diff --git a/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour.sln b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour.sln new file mode 100644 index 00000000..e3715bda --- /dev/null +++ b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34202.233 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HTML-Footer-Background-Colour", "HTML-Footer-Background-Colour\HTML-Footer-Background-Colour.csproj", "{B333B641-9B92-4381-B84B-54F54DDED5B2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B333B641-9B92-4381-B84B-54F54DDED5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B333B641-9B92-4381-B84B-54F54DDED5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B333B641-9B92-4381-B84B-54F54DDED5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B333B641-9B92-4381-B84B-54F54DDED5B2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {846438BB-6220-4399-BF59-E0AC706E8C52} + EndGlobalSection +EndGlobal diff --git a/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/HTML-Footer-Background-Colour.csproj b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/HTML-Footer-Background-Colour.csproj new file mode 100644 index 00000000..3f1cd4b9 --- /dev/null +++ b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/HTML-Footer-Background-Colour.csproj @@ -0,0 +1,15 @@ + + + + Exe + net6.0 + HTML_Footer_Background_Colour + enable + enable + + + + + + + diff --git a/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/Program.cs b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/Program.cs new file mode 100644 index 00000000..8e2cc69f --- /dev/null +++ b/HTML to PDF/Blink/HTML-Footer-Background-Colour/.NET/HTML-Footer-Background-Colour/Program.cs @@ -0,0 +1,28 @@ +//Initialize HTML to PDF converter. +using Syncfusion.HtmlConverter; +using Syncfusion.Pdf; +using Syncfusion.Drawing; + +HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); +//Initialize blink converter settings. +BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings(); +//Set the Blink viewport size. +blinkConverterSettings.ViewPortSize = new Size(1280, 0); +//Set the html margin-top value based on the html header height and margin-top value. +blinkConverterSettings.Margin.Top = 70; +//Set the html margin-bottom value based on the html footer height and margin-bottom value. +blinkConverterSettings.Margin.Bottom = 40; +//Set the custom HTML header to add at the top of each page. +blinkConverterSettings.HtmlHeader = "
HTML Header
"; +//Set the custom HTML footer to add at the bottom of each page. +blinkConverterSettings.HtmlFooter = "
HTML Footer
"; +//Assign Blink converter settings to the HTML converter. +htmlConverter.ConverterSettings = blinkConverterSettings; +//Convert the URL to a PDF document. +PdfDocument document = htmlConverter.Convert("
Hello World
",string.Empty); + +//Create a filestream. +FileStream fileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite); +//Save and close a PDF document. +document.Save(fileStream); +document.Close(true); \ No newline at end of file