from ironpdf import * html = """<p> Hello Iron</p> <p> This is 1st Page </p> <div style='page-break-after: always;'></div> <p> This is 2nd Page</p> <div style='page-break-after: always;'></div> <p> This is 3rd Page</p> <div style='page-break-after: always;'></div> <p> This is 4th Page</p>""" renderer = ChromePdfRenderer() pdf = renderer.RenderHtmlAsPdf(html) # Remove pages 2 and 3. Python uses zero-based indexing. pdf.RemovePages(1, 2) pdf.SaveAs("Page1And4.pdf")