PDF .NET Library Logo

How to use existing PDF documents as templates

The code sample below creates a PDF document using another PDF document as a template.

C# sample:

PDFCreationOptions options = new PDFCreationOptions();

options.TemplateFileName = "PDFTechLH.pdf";

options.TemplatePageNumber = 1;

options.TemplatePassword = "";

options.SetMargin(50, 160, 50, 160);

PDFDocument MyPdf = new PDFDocument("Templates.pdf", options);

MyPdf.CurrentPage.Body.SetTextAlignment(TextAlign.Justified);

MyPdf.CurrentPage.Body.SetColumnCount(ColumnCount.TwoColumn);

MyPdf.CurrentPage.Body.AddText("What a nice template.");

MyPdf.Save();

Back to PDF Code Library