Rank: Newbie Groups: Member
Joined: 1/5/2015 Posts: 2
|
Hello,
We use EOPdf to generate some pdf for a website we created. Unfortunately, there have been some examples found by our customer where the complete HTML we are converting is not being rendered into the pdf.
I created a simple controller method to recreate the issue that will render the pdf to a random file name on my d:\temp directory:
public ActionResult Index() { try { string pricesheetUrl = "http://jwhomes.com/Find-Your-Home/Georgia/Neighborhoods-in-the-Atlanta-GA-Area/Neighborhoods-in-Mableton-GA/Legacy-at-the-River-Line-Neighborhood/Price-Sheet"; //pricesheetUrl = "http://jwhomes.com/Find-Your-Home/Georgia/Neighborhoods-in-the-Atlanta-GA-Area/Neighborhoods-in-Cumming-GA/Vickery-Neighborhood/Price-Sheet"; EO.Pdf.HtmlToPdf.Options.MinLoadWaitTime = 3000; EO.Pdf.HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 1.0f, 7.5f, 6.5f); EO.Pdf.HtmlToPdf.ConvertUrl(pricesheetUrl, string.Format(@"D:\temp\{0}.pdf", Guid.NewGuid().ToString())); } catch (Exception) { throw; }
return View(); }
As you can see, we get the HTML to render from a PriceSheeUrl. In both the urls provided (one is commented out), the last entry is cut off.
For the "Legacy-at-the-River-Line-Neighborhood" you can see on the last page of the pdf that the entry for The Camden cuts off after two lines, even though there is more content in the HTML from the url. Additionally there is plenty of room to render the remaining content.
For the "Vickery-Neighborhood" you can see on the last page that not all the content for The Mayer floorplan is listed. Again, it cuts off after two lines.
Can you give us any insight into what is going on? Is there something we can change as far as the HTML to correct the issue?
Brian
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, Please try to remove "height:100%" in the following CSS block in your default.css:
Code: CSS
html {
height:100%;
}
body {
font-family: Tahoma, Arial, sans-serif;
margin:0px;
padding:0px;
width:100%;
height:100%;
}
#MainPanel {
background:#e9e9e9;
text-align:center;
height:100%;
}
Generally you should not use "height:100%" in your CSS because a browser engine calculates the page layout by fixing the page width (the window width) and automatically grows the page height if needed. So most of the time a 100% height does not make sense. In some cases this would make sense when the browser would interprets "height:100%" as the full window height ---- this causes problem for the HTML to PDF converter because it does not have a visible window, thus there is no clear definition of full window height. This causes some discrepancy between PDF and screen output. Remove the "height:100%" property would remove the source of the discrepancy thus generating the correct output. Thanks!
|
Rank: Newbie Groups: Member
Joined: 1/5/2015 Posts: 2
|
Thank you for looking into this. Removing the height: 100%; does indeed fix our issue.
Brian
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Great. Thanks for confirming that this resolves the problem!
|