From 25a857f259a69c24e95abf56a41efc5dd64b11b2 Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Tue, 9 Jan 2024 11:31:28 +0530 Subject: [PATCH 1/3] 864873 : Background color missing issue in HTML Header and Footer. --- .../Convert-HTML-To-PDF/troubleshooting.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md index 70e838b59..88462fdca 100644 --- a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md +++ b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md @@ -703,6 +703,67 @@ Code snippet: {% endtabs %} + + + + +## Background color missing issue in HTML Header and Footer + + + + + + + + + + + + +
Exception +Background color missing issue in HTML Header and Footer. +
Reason +We do not have the support for adding a custom CSS style in the HTML header and footer. +
Solution + +To resolve this issue, we can adding inline styles in element. However, we have attached the sample and output documents for your reference. +

+ +{% tabs %} + +Code snippet: + +{% highlight c# tabtitle="C#" %} + + 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); + +{% endhighlight %} + +{% endtabs %} + +You can download a complete working sample from GitHub. +
\ No newline at end of file From ba98a515bcf3ce0413f2655a56abcafaa63df608 Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Tue, 9 Jan 2024 15:04:08 +0530 Subject: [PATCH 2/3] 864873 : Update the content review changes. --- File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md index 88462fdca..8329f734b 100644 --- a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md +++ b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md @@ -726,12 +726,12 @@ Code snippet: Solution -To resolve this issue, we can adding inline styles in element. However, we have attached the sample and output documents for your reference. +To resolve this issue, we can add inline styles in element. However, we have attached the sample and output documents for your reference.

{% tabs %} -Code snippet: +Code sample: {% highlight c# tabtitle="C#" %} From 905b51c792517159b315915d1c1210e81555d2c5 Mon Sep 17 00:00:00 2001 From: Srihariharan Date: Tue, 9 Jan 2024 16:38:01 +0530 Subject: [PATCH 3/3] 864873 : Add github sample link. --- File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md index 8329f734b..271e26aa6 100644 --- a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md +++ b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md @@ -762,7 +762,7 @@ Code sample: {% endtabs %} -You can download a complete working sample from GitHub. +You can downloaded a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/HTML-Footer-Background-Colour/.NET).