EVO HTML to PDF Converter is not just a simple HTML to PDF converter, is also a complete library which you can use to edit existing PDF documents. You can create a Document object from an existing PDF document using the DocumentDocument(String) constructor which takes the full path a PDF file as parameter or the DocumentDocument(Stream) constructor which reads the PDF from a stream. There are also variants of these constructors taking an additional parameter which is the password to open the PDF document: DocumentDocument(String, String) and DocumentDocument(Stream, String).
A common example of editing an existing PDF document is you to add watermarks and stamps to that PDF document. The watermarks and stamps are implemented using EvoPdfTemplate objects which are repeated in each page of the generated PDF document. In a template you can add any PDF element that you can normally add in a PDF page, including HtmlToPdfElement objects or HtmlToPdfVariableElement.
protected void stampPdfButton_Click(object sender, EventArgs e) { Document pdfDocument = null; try { // Load the PDF document to stamp string pdfFileToStampPath = Server.MapPath("~/DemoAppFiles/Input/PDF_Files/PDF_Document.pdf"); pdfDocument = new Document(pdfFileToStampPath); // Set license key received after purchase to use the converter in licensed mode // Leave it not set to use the converter in demo mode pdfDocument.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c="; // Get the stamp width and height float stampWidth = float.Parse(stampWidthTextBox.Text); float stampHeight = float.Parse(stampHeightTextBox.Text); // Center the stamp at the top of PDF page float stampXLocation = (pdfDocument.Pages[0].ClientRectangle.Width - stampWidth) / 2; float stampYLocation = 0; RectangleF stampRectangle = new RectangleF(stampXLocation, stampYLocation, stampWidth, stampHeight); // Create the stamp template to be repeated in each PDF page Template stampTemplate = pdfDocument.AddTemplate(stampRectangle); // Create the HTML element to add in stamp template HtmlToPdfElement stampHtmlElement = new HtmlToPdfElement(htmlStringTextBox.Text, baseUrlTextBox.Text); // Set the HTML viewer width for the HTML added in stamp stampHtmlElement.HtmlViewerWidth = 600; // Fit the HTML content in stamp template stampHtmlElement.FitWidth = true; stampHtmlElement.FitHeight = true; // Add HTML to stamp template stampTemplate.AddElement(stampHtmlElement); // Save the PDF document in a memory buffer byte[] outPdfBuffer = pdfDocument.Save(); // Send the PDF as response to browser // Set response content type Response.AddHeader("Content-Type", "application/pdf"); // Instruct the browser to open the PDF file as an attachment or inline Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Stamp_PDF.pdf; size={0}", outPdfBuffer.Length.ToString())); // Write the PDF document buffer to HTTP response Response.BinaryWrite(outPdfBuffer); // End the HTTP response and stop the current page processing Response.End(); } finally { // Close the document to stamp if (pdfDocument != null) pdfDocument.Close(); } }