I have big problems with HTML2PDF! Nice HTML structure becomes all wrong when converted to PDF.
What am I doing wrong!?
Here's the HTML display in CE:
and here's the PDF Version! How can it be so different?
- It's got the wrong font.
- It doesn't have the correct top, bottom, right and left margins.
- It is inserting several spaces between paragraphs instead of just one...
- Further on in the document, I inserted a page break which isn't being recognized in the PDF output...
Here is my code:
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.AppendHeader("content-disposition", "attachment; filename=MyPDF.pdf")
Dim sm As System.IO.MemoryStream = New System.IO.MemoryStream
Dim html2pdf As CuteEditor.Convertor.PDF.HTML2PDF = New CuteEditor.Convertor.PDF.HTML2PDF(Editor1.Text)
Try
html2pdf.RenderSinglePageContent =
False
html2pdf.Render()
html2pdf.Save(sm)
sm.WriteTo(Response.OutputStream)
sm.Close()
Finally
sm =
Nothing
End Try
Response.End()
Exit Sub
And here's the HTML in CE:
<html xmlns:st1="">
<head>
</head>
<body style="font-size: 12px; font-family: Arial" bottommargin="75" leftmargin="100" topmargin="75" rightmargin="75">
<div>July 2, 2007</div>
<div> <strong><em><br />
Confidential <br />
Report to the Board of Directors</em></strong></div>
<div><strong><em>MyCompany Inc.</em></strong></div>
<div><strong><em> </em></strong></div>
<div><strong><em>Prepared by: Hason Jason</em>
<div></strong> </div>
</div>
<div>I would like to present our ideas with respect to both the short- and long-term needs of the company, considering its current financial, leadership and human resources state. </div>
<div> </div>
<div><strong>Overview</strong></div>
<div> </div>
<div>In recent years, the company has faced new challenges, ad infinitum and so one and one are often no longer two but rather become something entirely different.</div>
<div> </div>
<div>Some of those involve this, some involve that..</div>
<div> </div>
<div>Lot's of things are this and that. </div>
<div> </div>
<div>That mandate required the following tasks to be completed:</div>
<ul>
<li>Return to this
<li>Establish that
<li>Document stuff </li>
</ul>
<div><strong>Key executives</strong></div>
<div> </div>
<div>The company's executive staff:</div>
<ul>
<li>Joe Blow, CEO
<li>Jane Doe, COO
<li></li>
</ul>
<div><strong>Events</strong></div>
<div> </div>
<div>In June, 2007, Hason and Jason did this and that.<br />
</div>
</body>
</html>
I need to fix this right away. What should I do?
Fredd