Search code examples
c#pdfhorizontalscrollviewpdfsharpmigradoc

MigraDoc + PDFsharp to generate Horizontal PDF


I am using MigraDoc + PDFsharp for generating a PDF (Salary slip). The PDF that is generated is by default vertical. (A4 - vertical).

I want it to be generated as Horizontal. What changes do I need to do?

currently I'm able to get this PDF

Sample image of expected output


Solution

  • I assume you want to know how to set page format to landscape.

    PageSetup pageSetup = document.DefaultPageSetup.Clone();
    // set orientation
    pageSetup.Orientation = Orientation.Landscape;
    // ... set other page setting you want here...
    

    Assign that PageSetup to your section.

    See also: How to Set Document Orientation (for All Pages) in MigraDoc Library?