Delete PDF Pages programmatically
Contents
[
Hide
]
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 PHP.
// Open document
$document = new Document($inputFile);
$pages = $document->getPages();
// Delete a particular page
$pages->delete(2);
// Save output document
$document->save($outputFile);
$document->close();