|
//Load PDF document
PdfLoadedDocument ldoc = new PdfLoadedDocument("../../Data/Essential_Pdf.pdf");
//Create a new instance of PdfDocument class
Syncfusion.Pdf.PdfDocument document = new Syncfusion.Pdf.PdfDocument();
int margin = 10;
for (int i = 0; i < ldoc.Pages.Count; i++)
{
//Get loaded page as template
Syncfusion.Pdf.Graphics.PdfTemplate template = ldoc.Pages[i].CreateTemplate();
//Create section for PDF documet
PdfSection section = document.Sections.Add();
//Create new page
Syncfusion.Pdf.PdfPage pages = section.Pages.Add();
//Set increasing value of the page margin as margin of the PDF document
section.PageSettings.Margins.Left = margin;
section.PageSettings.Margins.Right = margin;
section.PageSettings.Margins.Top = margin;
section.PageSettings.Margins.Bottom = margin;
//Create Pdf graphics for the page
PdfGraphics g = pages.Graphics;
//Draw template with the size as loaded page size
g.DrawPdfTemplate(template, new PointF(0, 0), new SizeF(pages.GetClientSize().Width, pages.GetClientSize().Height));
margin += 20;
} |