Sure,
.pdf-text-input {
height: 40px;
width: 500px;
background-color: #FFF;
}
.rows-1 {
height: 100px;
}
p {
margin-top: 0;
}
.control {
margin-top: 18px;
padding-bottom: 20px;
page-break-before: always;
page-break-inside: avoid;
}
ul {
padding-left: 0;
margin: 0;
padding: 0;
}
body {
font-family: Arial;
}
.main {
background-color: #dcdcdc;
padding: 20px;
font-size: 10pt;
}
td.select-spacer {
padding: 2px 0;
}
h4 {
font-size: 10.5pt;
margin: 10px 0;
}
h2 {
margin-top: 0;
font-size: 17pt;
}
.validation {
padding-left: 15px;
margin-left: 0;
}
protected virtual void ConvertHtmlToPdf(Stream inputStream, Stream outputStream)
{
Pdf pdf = new Pdf();
// Specify the Character encoding for HTML file
pdf.HtmlInfo.CharSet = "UTF-8";
pdf.HtmlInfo.CharsetApplyingLevelOfForce = HtmlInfo.CharsetApplyingForceLevel.UseWhenImpossibleDetectFromContent;
pdf.IsLandscape = false;
pdf.PageSetup.Margin.Top = 10;
pdf.PageSetup.Margin.Bottom = 10;
pdf.PageSetup.Margin.Left = 10;
pdf.PageSetup.Margin.Right = 10;
pdf.BindHTML(inputStream, "");
pdf.Save(outputStream);
}
We're just writing the html file to a stream, and outputting it as a stream which we later write to a pdf file. It creates the PDF fine, but when you try it you can see the output doesn't look good because the div with class 'control' can get split over multiple pages. The page doesn't break well. As I mentioned earlier, the process of generating this html is dynamic so it would be exceptionally difficult to insert page breaks in the correct places even if they worked.
Thanks for your help.