Welcome Guest Search | Active Topics | Sign In | Register

HTML to PDF - transparent background Options
Nelson
Posted: Monday, February 25, 2013 3:36:48 PM
Rank: Newbie
Groups: Member

Joined: 2/25/2013
Posts: 3
Hi,

I'm using HtmlToPdf.ConvertUrl(..) to render a page, and even if the background of the page it's set to transparent or white, I still ended up with a document with a solid white background instead of transparent. So I'm wondering what am I missing, because in the following link is stated that one of the HTML2PDF features is the 'Multilayer rendering', wich renders the document with a transparent background:
http://www.essentialobjects.com/forum/postst5564_EOPdf-20112-with-HTML-to-PDF-converter.aspx

I tried to look at the HtmlToPdfOptions argument, but didn't found anything related to the background, so any ideas would be great.

Thank you,
Nelson
eo_support
Posted: Monday, February 25, 2013 3:50:48 PM
Rank: Administration
Groups: Administration

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

The background color is always filled as white. This is necessary for mixing colors with other half transparent contents (for example, an image with alpha channel). Try to think our converter as a browser window. The browser window itself will always have a solid background color ---- while you can overlay all kind of HTML elements one on top of each other, you can't see through the browser window.

Thanks!
Nelson
Posted: Monday, February 25, 2013 4:19:18 PM
Rank: Newbie
Groups: Member

Joined: 2/25/2013
Posts: 3
Hi,

thanks for the fast response. Maybe I need to better explain what I'm trying to do, so you could give me a solution, if its possible.

I need to render an html page that has some text, and after that, I need to add an image to the page to use it as a background.

What I tried is converting the page with HtmlToPdf.ConvertUrl(..), and right after that add the image using a PdfImageContent and page.Contents.Insert(0, image), in order to get the image just below the rendered page. But this didn't work, as the page is rendered with a white background, and only where the page ends I can see the image showing up.

Is there any way I can achieve this? Thank you,

Nelson
eo_support
Posted: Monday, February 25, 2013 4:26:27 PM
Rank: Administration
Groups: Administration

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

That won't work. You will have to have that image in your HTML --- for example, using it as a CSS background image.

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.