Welcome Guest Search | Active Topics | Sign In | Register

PDF loses word-wrap CSS Options
jim
Posted: Monday, November 4, 2013 3:25:56 PM
Rank: Newbie
Groups: Member

Joined: 8/1/2013
Posts: 3
We are using ASPXToPDF2 to create a print pdf version of a web page. If the web page is viewed before the PDF is created, text is wrapping in the HTML table cells just fine. But in the PDF that is created from that page, the text is not wrapping in the HTML table cells.

I tried using your EO.Pdf 2012 for .NET -- HTML (HTML File) to PDF Converter Demo feeding it the static HTML page and got the same result.

I have a saved copy of the HTML and the PDF that was saved from your demo page that I can email support.
eo_support
Posted: Monday, November 4, 2013 3:34:17 PM
Rank: Administration
Groups: Administration

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

This usually has to do with your HTML layout. The key difference between a HTML to PDF converter and a browser is, a browser window is usually much wider than a PDF page. A PDF page by default is only 8.5 inch wide, minus 1 inch margin on both side it is 6.5 inch, at 96 DPI it would be 624 pixel, which is a low narrower than a typical browser window. So try to reduce the width of your browser window and see if you see the same problem.

There are two ways to increase the pixel width of the PDF page without increasing its physical inch width. Both uses zoom level. One way is to add a fixed width element in your page. For example if you add the following code in your page:

<div style="width:1000px;height:1px"></div>

Then the converter will detect that your page has a mimimum width of 1000 pixels. It will then use this information to set a zoom level so that the page is zoomed out to fit this width. Alternatively, you can set HtmlToPdf.Options.ZoomLevel to a value less than 1. In both cases the text becomes smaller and the logical pixel width of the page increases.

If the page width is not the problem, try to verify your page with Google Chrome browser. Different browsers can render the same HTML differently. Our rendering is most close to Google Chrome.

If none of the above applies, please try to isolate the problem into a test page, then either provide the link to the test page, or post the content of the test page so that we can investigate further.

Thanks!
jim
Posted: Monday, November 4, 2013 3:44:50 PM
Rank: Newbie
Groups: Member

Joined: 8/1/2013
Posts: 3
Thank you for the very quick reply. I will try some of these suggestions.
NOTE: The page rendered in Chrome does indeed show the same behavior as the PDF (no wrapping), so that gives me something to go on. I will post results...
jim
Posted: Monday, November 4, 2013 4:19:00 PM
Rank: Newbie
Groups: Member

Joined: 8/1/2013
Posts: 3
Here is what fixed this issue:

1) adding a fixed width to the parent table of the cells that were not wrapping
2) changing the cell's CSS from
"-ms-word-wrap:break-word;" to "word-wrap:break-word;"

Thanks again for the very fast response!!!!!
Best support I have ever seen at a 3rd party control company in almost 20 years of development!
eo_support
Posted: Monday, November 4, 2013 4:20:49 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Glad to hear that and thanks for sharing! Please feel free to let us know if you have any other questions.

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.