Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML to PDF result in landscape

I am using PDFSharp to generate PDF from html source.

PdfGenerator.GeneratePdf(html, PageSize.A4);

Generate to pdf works well, but I dont know how I can change page orientation to landscape?

like image 557
Marek Avatar asked Dec 18 '14 18:12

Marek


1 Answers

the following code could be usefull for you:

        var config = new PdfGenerateConfig();
        config.PageOrientation= PageOrientation.Landscape;
        config.PageSize = PageSize.A4;

        PdfDocument pdf = PdfGenerator.GeneratePdf(documentHtmlContent, config);

        pdf.Save(FILE_OUT_PATH);

        Process.Start(FILE_OUT_PATH);
like image 179
daniel Avatar answered Sep 25 '22 09:09

daniel