Welcome Guest Search | Active Topics | Sign In | Register

ASPXtoPDF page orientation Options
Duane
Posted: Friday, September 16, 2011 1:31:06 PM
Rank: Advanced Member
Groups: Member

Joined: 9/4/2007
Posts: 114
I am using the ASPXtoPDF.RenderAsPDF() method and setting page size in the _BeforeRender event handler:

e.g. :
Code: C#
protected void ASPXToPDF1_BeforeRender(object sender, EventArgs e)
{
        HtmlToPdf.Options.PageSize = PdfPageSizes.ArchB;
}


Is there an option to set the page orientation to landscape similar to the way it is done in the ACM?

Thanks
eo_support
Posted: Friday, September 16, 2011 1:35:38 PM
Rank: Administration
Groups: Administration

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

HtmlToPdf.Options.PageSize is the equivalent of AcmRender.SetDefPageSize for the HTML to PDF component. These two are very similar in nature. Is there any reason you have to do it in the ACM way?

You can set the page size immediately you call RenderAsPDF. You do not have to do it inside BeforeRender event handler.

Thanks!
Duane
Posted: Friday, September 16, 2011 3:43:26 PM
Rank: Advanced Member
Groups: Member

Joined: 9/4/2007
Posts: 114
I didn't really mean I "had" to set the page size like it is done in ACM, I just didn't connect with the HtmltoPdf.Options.PageSize.Height and HtmltoPdf.Options.PageSize.Width properties.

As in the ACM, you don't set orientation as a property, you just define the float values for HtmltoPdf.Options.PageSize.Height and HtmltoPdf.Options.PageSize.Width as 11f; and 8.5f respectively.

I only set it in the _BeforeRender event handler because it was descibed that way in your documentaion. Setting the above .Height and .Width attributes immediately [before] calling the .RenderAsPDF(); line works fine.

Please correct me if the above is not correct.

Thanks
eo_support
Posted: Friday, September 16, 2011 3:51:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
I see. ACM and Html to PDF are two different set of interfaces so they are indeed a bit different. Your statement above are all correct. You can set HtmlToPdf.Options either before calling RenderAsPDF or inside your BeforeRender handler. Both should work.

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.