Changing Page Size

Here we modify the document by changing the page sizes.

This can be used to change the aspect ratio of the output. However be aware that some elements - most commonly tables - have specified width so they may not expand to fill the space.

We read a DOCX file. We set the page size on the Section frames. Finally we save the output.

Changing page size in a Word document.
C#
string src = TestEnvironment.FixturePath("MaryLamb.docx");
string dst = TestEnvironment.OutputPath("WideMary.pdf");
var doc = new Doc();
doc.SetFile(src);
var sections = new List<SectionFrame>();
doc.DocumentFrame.Scan((f) => {
    if (f is SectionFrame)
        sections.Add((SectionFrame)f);
});
foreach (SectionFrame sect in sections)
    sect.StyleStore.Entries["PageSize"] = "800 400";
doc.SaveAs(dst);