I generate a card with html and then I convert it to pdf with SelectPdf converter. The problem is, I can't seem to fit the card and pdf page perfectly, without no "white paper". My goal is that the card and pdf page are the same size, so i can print it.
the code (c#):
HtmlToPdf converter = new HtmlToPdf();
var doc = new PdfDocument();
converter.Options.PdfPageSize = PdfPageSize.Custom;
converter.Options.PdfPageCustomSize = new SizeF(Convert.ToInt32(paperWidth), Convert.ToInt32(paperHeight));
doc = converter.ConvertHtmlString(cardString);
return doc.Save();
If you use
div
element, in CSS you can use@media
print to specify formatting when printed.If you want to know more , read this