Welcome Guest Search | Active Topics | Sign In | Register

ConvertHtml and Floating images Options
Sit3coreD3v
Posted: Wednesday, July 29, 2015 1:12:43 AM
Rank: Newbie
Groups: Member

Joined: 6/29/2015
Posts: 9
Hi,
I have some html which renders fine on the website but now when converted to HTML.

It's basically a left floated image with text that wraps around it. The PDF shows the image on left but only the first line of the Text, the rest of the text is underneath the image so it looks very weird.

The html is as follows:
<p>
<img alt="blah" src="url" class="send-left"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus maximus erat nec odio commodo aliquam. Nam non lectus eu turpis tincidunt semper ac at urna. Curabitur dignissim accumsan augue, sed commodo dui aliquam vel. Suspendisse tempus in urna eget auctor. Morbi pharetra metus rhoncus porttitor rhoncus.
</p>

the css class is:
.send-left {
float: left;
margin: 0 30px 15px 0;
}


The webpage itself renders correctly, however the PDF shows the image left aligned but the first line of the text block shows vertically centered to the image and the rest of the content block continues underneath the image.

Is there a better way to handle this situation so that the PDF renders correctly...please note we also float right (therfore content would be on left)

Thanks
Sit3coreD3v
Posted: Wednesday, July 29, 2015 8:30:35 PM
Rank: Newbie
Groups: Member

Joined: 6/29/2015
Posts: 9
found the problem in case anyone else encounters this, in-line styles are needed to float so got rid of the class and just did style="float:left;"
eo_support
Posted: Wednesday, July 29, 2015 8:48:48 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Thanks for the update. However you can either using inline style or external CSS files. The key is when you use external CSS file and your CSS file path is a partial path (for example, href="styles.css"), then you must set HtmlToPdf.Options.BaseUrl. Otherwise the converter would have no idea where to download your CSS file thus not able to apply the rules in your file.


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.