7

我正在使用 PDFSharp 从 html 源生成 PDF。

PdfGenerator.GeneratePdf(html, PageSize.A4);

生成为 pdf 效果很好,但我不知道如何将页面方向更改为横向?

4

1 回答 1

14

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);
于 2015-08-03T15:11:34.803 回答