We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Html to PDF : how to set some pages in landscape

Hi everyone !
i’m currently using Aspose.Pdf v to generate a PDF document using a basic HTML File.
The fact is, that i would like to have some pages in landscape mode, but i can’t manage to do that.

My needs are :
If the current pageNumber>2
then i set the IsLandScape to true

i try this, but it doesn’t works :frowning:



foreach(Section section in myPdfDocument.Sections)
foreach(Paragraph paragraph in section.Paragraphs)
if(myPdfDocument.GetPageNumber(paragraph.ID) > 2)
myPdfDocument.IsLandscape = true;

Anyone has an idea ?

Thanks a lot for any help :slight_smile:

Kind Regards,

Hello John,

We are looking into the details of this issue and soon will update you with the status of correction. Thanks for your patience.

Hi John,

We have checked this issue and found that you can set all pages to landscape by setting in Pdf.HtmlInfo. But setting some of the pages to landscape is not supported.

Hello Forever,

Thanks a lot for your answer, and sorry for the late to answer.
In fact i tryed another way to obtain this kind of orientation into a pdf.
I generated two documents.
The first one is “normal” and the second one is set to landscape.
Then i merge those, using Aspose.Pdf.Kit and it works fine !

Hope this way can helps other people :slight_smile:

Have a nice day,
Best Regards,