Welcome Guest Search | Active Topics | Sign In | Register

Page Orientation Options
Alester Gómez
Posted: Tuesday, July 10, 2012 4:56:18 PM
Rank: Member
Groups: Member

Joined: 7/10/2012
Posts: 14
Hi.
Using HtmlToPdf.ConvertUrl how can I set the page orientation. I need to set it to landscape. I am evaluating your software and it is a requiretment from my customer.
eo_support
Posted: Tuesday, July 10, 2012 5:04:16 PM
Rank: Administration
Groups: Administration

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

You would just set HtmlToPdf.Options.PageSize to a different size with width/height value reversed.

Thanks
Robert Allen
Posted: Wednesday, July 11, 2012 9:22:36 AM
Rank: Newbie
Groups: Member

Joined: 7/10/2012
Posts: 5
Here's some example code:
Code: C#
HtmlToPdf.Options.PageSize = GetPageSize(PageOrientation.Landscape);

...

private SizeF GetPageSize(PageOrientation pageOrientation)
{
	return pageOrientation == PageOrientation.Portrait
		? new SizeF(PdfPageSizes.A4.Width, PdfPageSizes.A4.Height) // A4 portrait
		: new SizeF(PdfPageSizes.A4.Height, PdfPageSizes.A4.Width); // A4 landscape
}

...

public enum PageOrientation
{
	Portrait = 0,
	Landscape = 1
}


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.