Welcome Guest Search | Active Topics | Sign In | Register

HTML Rendering differently when converted. Options
David Y
Posted: Wednesday, August 29, 2012 10:56:44 AM
Rank: Newbie
Groups: Member

Joined: 8/29/2012
Posts: 2
We have some cases where html divs render with word wrapping when converted to pdf but when viewed as html they are not. The following html snippet is a good example.

I've tried adding white-space:nowrap to the div style and that works however, now the text extend beyond the div. This is also different between the converted pdf and the html.
--begin html
<html>
<head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Meta NAME="YCDocGenerator_Version" CONTENT="1.0">
<Meta NAME="YCDOCGenerator_LeftMargin" CONTENT="0.25">
<Meta NAME="YCDOCGenerator_RightMargin" CONTENT="0.25">
<Meta NAME="YCDOCGenerator_TopMargin" CONTENT="0.25">
<Meta NAME="YCDOCGenerator_BottomMargin" CONTENT="0.25">
<Meta NAME="Print_Orientation" CONTENT="landscape">
<Meta NAME="Print_Papersize" CONTENT="LETTER">
<style>
DIV {position: absolute; color: #000000;}
SPAN {cursor: hand;}
A:link {color: blue;}
A:visited {color: blue;}
A.line {position: absolute; color: black; text-decoration: none; font-size: 0pt;}
A.line:visited {color: black;}
</style>
</head>
<body bgcolor="#FFFFFF">
<div style="text-align:Left;background:transparent;top:0.5in; left:0.25in; width:10.5in; height:0.197916666666667in; font:bold 12pt 'Arial';
<div style="text-align:Left;background:transparent;top:1.48166666666667in; left:0.25in; width:0.63in; height:0.145833333333333in; font:8pt 'Arial'; ">01/01/2011</div>
<div style="text-align:Left;background:transparent;top:1.48166666666667in; left:0.9in; width:1.08in; height:0.145833333333333in; font:8pt 'Arial'; ">Grant Memorial Hosp</div>
</body>
</html>
--end html


--begin code used to convert to pdf
PdfDocument doc = new PdfDocument();
HtmlToPdf.Options.PageSize = new SizeF(PdfPageSizes.Letter.Height, PdfPageSizes.Letter.Width);
EO.Pdf.HtmlToPdf.Options.OutputArea = new RectangleF(0.25f, 0.25f, 11.0f, 8.5f);

HtmlToPdf.ConvertUrl("c:\\temp\\1_Test.htm", doc);
MemoryStream ms = new MemoryStream();
doc.Save(ms);

File.WriteAllBytes("c:\\temp\\test.pdf", ms.ToArray());

--end code

thanks
eo_support
Posted: Wednesday, August 29, 2012 11:58:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

Try to use Google Chrome browser to verify your HTML. Our rendering result is most close to Google Chrome, that sometimes is significantly different that how IE renders it.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.