removePage method
Removes the page at currentPage (1-based index) from the PDF.
Returns the updated file if successful, or null otherwise.
Implementation
Future<File?> removePage(int currentPage, File pdfFile) async {
final PdfDocument pdfDoc = PdfDocument(
inputBytes: await pdfFile.readAsBytes(),
);
if (pdfDoc.pages.count > 1) {
pdfDoc.pages.removeAt(currentPage - 1);
return await saveFile(pdfDoc: pdfDoc, pdfFile: pdfFile);
}
return null;
}