+1 (407) 567-0096

Editor Features

Here you can find a quick overview and test of the PDFPrinting.NET Editor module. For more details, please visit our quick start guide or check out the reference documentation.


  • Edit text and fonts.
  • Add comments and markup.
  • Inser and delete pdf pages
  • Rotate and move pages.
  • Set PDF security permission.
  • Fill in a PDF form.
  • Extract a document page.
  • Export PDF to other formats.
  • Modify color space.

List of the following feature


Create new PDF document

This example will demonstrate how you can easily create a new PDF document and add some text and images to it.

Editing
  • PdfDocument pdfDocument = new PdfDocument();
  • var page = pdfDocument.AddPage();
  • page.Size = PdfEdit.PageSize.A4;
  • XGraphics gfx = XGraphics.FromPdfPage(page);
  • gfx.DrawString("How deep is the rabbit hole?", new XFont("Ariel", 10), XBrushes.Blue, new PointF(100, 100));
  • XImage image = XImage.FromFile(@"c:\images2\w3c_home.jpg");
  • gfx.DrawImage(image, new Point(300, 300));
  • gfx.Dispose();
  • pdfDocument.SetLicenseInfo("companyName", "licenseKey");
  • pdfDocument.Save(@"c:\test\test.pdf");

Add pages to existing PDF document

Here we will take an existing PDF document and append additional pages to it. The newly appended pages will not contain any content.

Editing
  • PdfDocument pdfDocument = PdfReader.Open(@"c:\test\test.pdf", PdfDocumentOpenMode.Modify);
  • var newPage = pdfDocument.AddPage();
  • var newPage2 = pdfDocument.AddPage();
  • pdfDocument.SetLicenseInfo("companyName", "licenseKey");
  • pdfDocument.Save(@"c:\test\test.pdf");

Edit existing PDF document

In this case, we take an existing document and insert a watermark on every page. This example uses a text message as the watermark, but you can just as easily insert an image.

Editing
  • PdfDocument pdfDocument = PdfReader.Open(@"c:\test\test.pdf", PdfDocumentOpenMode.Modify);
  • foreach(var page in pdfDocument.Pages)
  • {
  • 	XGraphics gfx = XGraphics.FromPdfPage(page);
  • 	gfx.DrawString("Lets pretend this is a watermark message...", new XFont(this.Font.FontFamily.Name, 10),
                                                                        XBrushes.Red,  new PointF(50, 50));
  • 	XImage image = XImage.FromFile(@"c:\images\w3c_home.bmp");
  • 	gfx.DrawImage(image, new Point(150, 150));
  • 	gfx.Dispose();
  • }
  • pdfDocument.SetLicenseInfo("companyName", "licenseKey");
  • pdfDocument.Save(@"c:\test\test.pdf");

Remove pages from PDF document

Now we will open a PDF document, check if it contains at least two pages and if yes remove the second page.

Editing
  • PdfDocument pdfDocument = PdfReader.Open(@"c:\test\test.pdf", PdfDocumentOpenMode.Modify);
  • if (pdfDocument.Pages.Count > 1)
  • 	pdfDocument.Pages.RemoveAt(1); // remove second page
  • pdfDocument.SetLicenseInfo("companyName", "licenseKey");
  • pdfDocument.Save(@"c:\test\test.pdf");

Extracts pages from PDF document

Let's try now to extract every second page from an existing document. This code would create a new document which would contain every second page from the original document. The original document would stay unharmed.

Editing
  • PdfDocument pdfDocument = PdfReader.Open(@"c:\test\test.pdf", PdfDocumentOpenMode.Import);
  • PdfDocument newPdfDocument = new PdfDocument();
  • for (int i = 0; i < pdfDocument.Pages.Count; i++)            
  • 	if ((i + 1) % 2 == 0)
  • 		newPdfDocument.AddPage(pdfDocument.Pages[i]);
  • 
                                                                
  • newPdfDocument.SetLicenseInfo("companyName", "licenseKey");
  • newPdfDocument.Save(@"c:\test\test2.pdf");

Protect PDF document and set user access permission

Let's now open an existing document, encrypt it with AES256, change the user access permission and secure it with a username and password. As you can see from the code we, for example, disabled full quality prints and form fills.

Editing
  • PdfDocument pdfDocument = PdfReader.Open(@"c:\test\test.pdf", PdfDocumentOpenMode.Modify);
  • pdfDocument.SecuritySettings.PdfDocumentEncryptionAlgorithm = new EncryptionAlgorithmInfo();
  • pdfDocument.SecuritySettings.PdfDocumentEncryptionAlgorithm.Type = PdfDocumentSecurityLevel.AES_256;
  • // user access permissions
  • pdfDocument.SecuritySettings.OwnerPassword = "ownerPass";
  • pdfDocument.SecuritySettings.UserPassword = "userPass";
  • pdfDocument.SecuritySettings.PermitAccessibilityExtractContent = true;
  • pdfDocument.SecuritySettings.PermitAnnotations = true;
  • pdfDocument.SecuritySettings.PermitAssembleDocument = true;
  • pdfDocument.SecuritySettings.PermitExtractContent = true;
  • pdfDocument.SecuritySettings.PermitFormsFill = false;
  • pdfDocument.SecuritySettings.PermitFullQualityPrint = false;
  • pdfDocument.SecuritySettings.PermitModifyDocument = true;
  • pdfDocument.SecuritySettings.PermitPrint = true;
  • pdfDocument.SetLicenseInfo("companyName", "licenseKey");
  • pdfDocument.Save(@"c:\test\test.pdf");        

Try PDFPrinting.NET demo for free!

This website uses cookies

This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Cookie Policy.
Read more