Overlays in PDF combines one or more files with one or more page sizes and their orientation. In essence, overlaying in PDF for .NET allows you to specify page size and orientation at any time by setting PaperKind, PageSize, and Landscape properties.
Consider that you want to create a single Pdf document with different paper sizes. To add such page overlays in a Pdf document, you can define PaperKind enumeration.
The following code showcases how to add different types of pages in a Pdf document.
C# |
Copy Code
|
---|---|
C1PdfDocument pdf = new C1PdfDocument(); Font font = new Font("Arial", 20); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; // Create one page with each paper size. bool firstPage = true; foreach (PaperKind pk in Enum.GetValues(typeof(PaperKind))) { // Skip custom size. if (pk == PaperKind.Custom) { continue; } // Add new page for every page after the first one. if (!firstPage) { pdf.NewPage(); } firstPage = false; // Set paper kind. pdf.PaperKind = pk; // Draw some content on the page. pdf.DrawString("PaperKind: " + pk.ToString(), font, Brushes.Black, pdf.PageRectangle, sf); |