I am using TuesPechkIn to convert my html to PDF. I am setting the configuration as follows:
My question is, can I remove the top margin from the first page of the PDF only? (Basically its the cover page which includes a banner image). Is there any way to implement this.
var document = new HtmlToPdfDocument
{
GlobalSettings =
{
DocumentTitle = "My Report",
PaperSize = PaperKind.A4,
Margins =
{
Top = 1.25, //Need to make it as 0 for the first page
Left = 0.00,
Right = 0.00,
Bottom = 1.25,
Unit = TuesPechkin.Unit.Centimeters
},
PageOffset = 2
},
Objects =
{
new ObjectSettings
{
HtmlText = htmlText,
FooterSettings = footerSettings
}
}
};
return converter.Convert(document);
A work around would be to remove that image in JavaScript. I was having the same issue on an element in the last bottom page an basically what I did was:
put that code when the window loads and add it to your
htmlText, it will remove the element for you before it generates the PDF. To do this you need to enable js by simply adding to yourObjects:Hope it helps you :)