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?
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?
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);
© 2022 - 2024 — McMap. All rights reserved.
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