Add LayoutGrid Page Element to PDF
Adding a LayoutGrid
to a PDF using DynamicPDF Generator is straightforward.
How to Add LayoutGrid Page Element to PDF in C#
The following steps and sample code add a LayoutGrid
to a PDF document using DynamicPDF Core Suite.
Steps for Adding LayoutGrid Page Element to a PDF Document
- Create a
Document
object. - Create a
Page
object and add it to theDocument
instance. - Create a
LayoutGrid
object by specifying the grid type. - Add a
Rectangle
to thePage
instance (to test theLayoutGrid
). - Add the
LayoutGrid
instance to thePage
instance. - Save the PDF document.
Sample Code - C#
Document document = new Document();
Page page = new Page();
document.Pages.Add(page);
LayoutGrid grid = new LayoutGrid(LayoutGrid.GridType.Decimal);
page.Elements.Add(new Rectangle(50, 50, 50, 50, 2));
page.Elements.Add(grid);
document.Draw(@"Output.pdf");
GitHub Project
Clone or view the example project at GitHub. This example code is contained in the Examples/LayoutGridExample.cs file.
Getting Started
NuGet Package
DynamicPDF Core Suite is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET
package. The easiest way to install DynamicPDF Core Suite it through the Visual Studio Package Manager. You can also download the package directly from NuGet.
DynamicPDF Core Suite Information
DynamicPDF Core Suite contains over 75 page elements you can add rich content to the PDFs you create. Elements include:
- Images,
- Text Objects (TextArea and Label),
- HTML,
- Barcodes (47 types),
- Form Fields,
- and Charts.
More information can be found here at the following website.
Available on Other Platforms
DynamicPDF Core Suite is available for the Java and COM/ActiveX platforms. Refer to the respective product pages for more details.
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX