Delete PDF Pages programmatically Python
Contents
[
Hide
]
You can delete pages from a PDF file using Aspose.PDF for Python via .NET. To delete a particular page from the PageCollection collection.
Delete Page from PDF File
- Call the delete() method and specify the page’s index
- Call the save() method to save the updated PDF file The following code snippet shows how to delete a particular page from the PDF file using Python.
import aspose.pdf as apdf
from os import path
path_infile = path.join(self.dataDir, infile)
path_outfile = path.join(self.dataDir, outfile)
document = apdf.Document(path_infile)
document.pages.delete(2)
document.save(path_outfile)