HTML to PDF result in landscape

5k views Asked by At

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?

1

There are 1 answers

0
daniel On

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);