SharpLeaf Tutorials > Document Layout Tutorials > Simple DocumentLayouts

Simple DocumentLayouts

A minimal document layout with a single page definition with a simple frame and a page counter.

The following script uses the aplparas variable.

  // A5 Landscape paper
   page = new PageLayout(PaperSize.Landscape(PaperSize.A5));
  // Use half-inch margin all around (invisible frame with no gutter)
   page.Add(new Frame("Main",36,36,-36,-36));
  // Use default font for page counter
   font = new FontType();
  // Page counter in center of bottom margin
   page.Add(new TextBlock("{page}/{pages}",font,36,-18,-36,-18,Alignment.Center,
            VerticalAlignment.Middle,false));

  // Our document layout has a single page definition - which applies to all pages
   layout = new DocumentLayout(page);

   lf = new SharpLeaf(layout);
  // Start flowing text using all default settings
   lf.AddParagraphs(aplparas);

See also ...

SharpLeaf Tutorials | Advanced DocumentLayouts | PageLayout Glossary


Send comments on this topic
© Dyalog Ltd 2021