Welcome Guest Search | Active Topics | Sign In | Register

How to change the margin of my PDF output Options
Bernie
Posted: Tuesday, August 6, 2013 9:43:04 PM
Rank: Newbie
Groups: Member

Joined: 10/18/2012
Posts: 6
Hi. I've been using the EO PDF library to generate output for large floorplan drawings that contain multiple overlaid layers. I use the following c# statements to generate the PDF:

HtmlToPdf.Options.PageSize = new SizeF(PdfPageSizes.A3.Height, PdfPageSizes.A3.Width);
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.None;
HtmlToPdf.ConvertHtml(reportHtm, streamPdf);

The default 1 inch page margin appears in the resulting PDF. I've been asked to minimize the margin. To do so, I've tried:

HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 0.5f, 9f, 15f);

And various tweaks to this. Nothing I do has any effect on the margin size. Is there anything obvious that I'm not doing?

Thanks for your help,
Bernie
eo_support
Posted: Tuesday, August 6, 2013 9:49:15 PM
Rank: Administration
Groups: Administration

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

OutputArea is the right way to do it:

http://www.essentialobjects.com/doc/4/htmltopdf/page_size.aspx

Thanks!
Bernie
Posted: Wednesday, August 7, 2013 12:01:52 PM
Rank: Newbie
Groups: Member

Joined: 10/18/2012
Posts: 6
Thank you for your prompt response. Should the following sequence of statements have the intended effect?

HtmlToPdf.Options.PageSize = new SizeF(PdfPageSizes.A3.Height, PdfPageSizes.A3.Width);
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.None;
HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 0.5f, 9f, 15f);
HtmlToPdf.ConvertHtml(reportHtm, streamPdf);

Thanks,
Bernie
eo_support
Posted: Wednesday, August 7, 2013 5:40:48 PM
Rank: Administration
Groups: Administration

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

Your code looks fine. Even though your page size is 16.5 by 11.7. So your left and top margin will be 0.5, but your right margin will be much bigger (16.5 - 0.5 - 9 = 7), and the bottom will overflow because you set your output area to be 15 inch high but your page is only 11.7 inch high.

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.