diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md index 70e838b59..271e26aa6 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 add inline styles in element. However, we have attached the sample and output documents for your reference.
+ + +{% tabs %} + +Code sample: + +{% 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 downloaded a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/HTML%20to%20PDF/Blink/HTML-Footer-Background-Colour/.NET).
+
|