Merge Capabilities |
The HTML to PDF Converter provides you with the possibility to append a PDF file or a list of PDF files to the conversion result. This possibility is available with the AppendPDFFile and AppendPDFFIleArray properties from PdfDocumentOptions class. The properties must be set before calling the PDF render method. There also available similar properties to append PDF streams instead of files.
The prototypes of these properties are:
For more details please take a look a the WinForms_PrependAppendExternalPdfs sample application from our product archive. Sample code from the application:
PdfConverter pdfConverter = new PdfConverter(); //pdfConverter.LicenseKey = "put your license key here"; // get the documents that will be appended to the result of the conversion of first URL byte[] doc2Bytes = pdfConverter.GetPdfFromUrlBytes(textBoxURL2.Text); pdfStream2 = new MemoryStream(doc2Bytes); byte[] doc3Bytes = pdfConverter.GetPdfFromUrlBytes(textBoxURL3.Text); pdfStream3 = new MemoryStream(doc3Bytes); // set the PDF streams to be appended to the result of the conversion of the first URL pdfConverter.PdfDocumentOptions.AppendPDFStreamArray = new Stream[] { pdfStream2, pdfStream3 }; //Produce the final PDF as a merge of the URL1, URL2 and URL 3 conversions string outFilePath = Path.Combine(Application.StartupPath, "MergedDocument.pdf"); pdfConverter.SavePdfFromUrlToFile(textBoxURL1.Text, outFilePath);