Welcome Guest Search | Active Topics | Sign In | Register

Acm PDF Creation: Set full page background color Options
justin
Posted: Friday, December 19, 2014 1:23:05 PM
Rank: Newbie
Groups: Member

Joined: 12/19/2014
Posts: 1
Hello all,

I am in the process of transitioning PDF libraries.

How can I go about setting the background color for an entire page with the PDF Creator? I can't imagine this being complex but I can't find any info on how to do it. Right now I have an AcmBlock with it's background color set and no margin on the page, but this doesn't fill the entire height of the page.

How can I set the background color for the page itself, or make an AcmBlock fill the entire page?
eo_support
Posted: Friday, December 19, 2014 3:02:44 PM
Rank: Administration
Groups: Administration

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

There is no easy way to do this because a HTML file will always have a solid background (by default it's white). So in order to fill the background with a solid non white color, you will need to:

1. Use HtmlToPdf.Options.BeforeRenderPage to set a before render page handler. This handler is called before the HTML to PDF converter generates output on a page. The event arguments will give you the PdfPage object. At this stage the PdfPage object is blank. You can fill it with a solid color using ACM interface. See here for more information on how to use ACM interface:

http://www.essentialobjects.com/doc/4/acm/overview.aspx

During this stage you will fill the entire page area, including the page margin area.

2. Once you fill the page with a solid color (for example, blue), then the converter will proceed to output on that page. During this stage the main output area (excluding margin, header and footer) will have your HTML page's background color (by default white). Thus after this stage the main output area will become white. In order for you HTML output area's background color to match the whole page's background color, you must apply the corresponding CSS styles on your HTML. For example, if you want HTML area to be blue, then you can apply body { background-color: blue; } in your CSS.

Hope this makes sense to you. Please feel free to let us know if you still 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.