Welcome Guest Search | Active Topics | Sign In | Register

PDF rendering left and right margins of the content Options
Solo
Posted: Friday, July 12, 2013 5:00:42 PM
Rank: Newbie
Groups: Member

Joined: 3/19/2013
Posts: 2
Hello,

I am using EO.PDF to convert a report. The report has margins to the left and right showing the website background. I have created @media printable and non-printable classes and it works well except for the left and right margins of the report container (pnlReport).

Here is that code snippet:

EO.Pdf.HtmlToPdf.Options.InvisibleElementIds = "non-printable;button-non-printable";
EO.Pdf.HtmlToPdf.Options.VisibleElementIds = "printable;pnlReport";

The control pnlReport is an ASP:Panel that holds the contents of the report, and it is contained within my content placeholder. Nothing outside the panel should be converted.

Please help, and thanks in advance.
eo_support
Posted: Friday, July 12, 2013 5:14:02 PM
Rank: Administration
Groups: Administration

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

It doesn't work that way. InvisibleElementId and VisibleElementId works on whole element. So for example, if element A contains element B and element A is invisible, then the entire element A is invisible. It is not possible for you to hide only part of element A. In addition, the converter do not recognize @media print either. Our goal is to render everything exactly the same as you see on the screen. So we do always use screen target.

There are a number of options for your case. One way is to add an additional argument to your code (for example, page.aspx?export=1), then modify your code to render output differently. This is very similar to many website that offers a "printer friendly" version for certain pages. Another way is to add additional script in your page to detect whether the page is running inside our converter. If you see the page is running inside our converter, you can do certain things accordingly (for example, to change the CSS class of your body element to turn off background). See here for more information on how to detect the converter with JavaScript:

http://www.essentialobjects.com/doc/4/htmltopdf/eo_js.aspx#check

Hope this helps. Please feel free to let us know if you have any more 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.