Welcome Guest Search | Active Topics | Sign In | Register

Css, media attribute in PDF Options
Erisma
Posted: Tuesday, August 16, 2011 7:31:29 AM
Rank: Member
Groups: Member

Joined: 8/12/2011
Posts: 16
Hi,
We're very pleased so far with our testing of EO.Pdf. But we tested with one of our customers reports, which contains CSS rules in a <style media="print">-tag. EO.Pdf seems to ignore these rules, which perhaps is the correct way since creating a PDF isn't necessarily the same as printing a page. But we need to somehow have different CSS-rules for when viewing a page, and when creating a PDF of it. Is there any way to do this with EO.Pdf? It doesn't have to be with media="print".

Thanks!
eo_support
Posted: Tuesday, August 16, 2011 7:42:09 AM
Rank: Administration
Groups: Administration

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

The HTML to PDF converter does not render it as "print", so it will ignore media="print" rules. One easy way is to use different CSS files and then swap the CSS file. If you are generating the HTML text, then you can code to use a different CSS file when you pass the text to the converter; If you do not wish to do that, you can put some JavaScript code in your page to detect whether the page is running inside our converter, then switch the CSS file if you see it's inside the converter. See here for more details on how to detect our converter with JavaScript:

http://doc.essentialobjects.com/library/4/htmltopdf/eo_js.aspx

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
Erisma
Posted: Tuesday, August 16, 2011 9:25:49 AM
Rank: Member
Groups: Member

Joined: 8/12/2011
Posts: 16
Hi,

We solved it with the JavaScript option.

Thanks alot!
eo_support
Posted: Tuesday, August 16, 2011 10:02:06 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Great. Thanks for the update!


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.