Delete PDF Pages programmatically

Delete Page from PDF File

  1. Call the delete method and specify the page’s index
  2. 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();