HTML to PDF result in landscape
Asked Answered
O

1

8

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?

Oxbow answered 18/12, 2014 at 18:1 Comment(4)
Wrong tag: PdfGenerator is not part of PDFsharp.Skidproof
Yes, but I cant use right tag htmlrenderer.Oxbow
Did you manage to find a solution for this as I require landscape mode when using PdfGenerator.GeneratePdf? Also looks like HtmlRenderer.PdfSharp is no longer supported so unless someone has managed to implement landscape mode when generating Pdf's from HTML I may have to grab the source code and make the changes myself.Skantze
Unfortunately no, I had to manual create this page by MigraDoc.Oxbow
D
17

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);
Deaf answered 3/8, 2015 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.