/** * <strong><a href="https://ironpdf.com/downloads/python-edit-pdf.zip">Download</a> the software product.</strong> */ from ironpdf import * # Instantiate Renderer renderer = ChromePdfRenderer() # Join Multiple Existing PDFs into a single document pdfs = List[PdfDocument]() pdfs.Add(PdfDocument.FromFile("A.pdf")) pdfs.Add(PdfDocument.FromFile("B.pdf")) pdfs.Add(PdfDocument.FromFile("C.pdf")) pdf = PdfDocument.Merge(pdfs) pdf.SaveAs("merged.pdf") # Add a cover page pdf.PrependPdf(renderer.RenderHtmlAsPdf("<h1>Cover Page</h1><hr>")) # Remove the last page from the PDF and save again pdf.RemovePage(pdf.PageCount - 1) pdf.SaveAs("merged.pdf") # Copy pages 5-7 and save them as a new document. pdf.CopyPages(ToPageList([4, 6])).SaveAs("excerpt.pdf") for eachPdf in pdfs: eachPdf.Dispose()