|
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.
|
|
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
|
|
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
}
|
|