-
Notifications
You must be signed in to change notification settings - Fork 877
Description
The pdf file I get from a webpage starts with a blank page, which I want to remove before writing the file, but removing a page from PdfDocument throws an exception.
I tried it like this:
`final path = Constants.filePath;
final PdfDocument document = PdfDocument(inputBytes: response.bodyBytes);
int count = document.pages.count; //8
final page = document.pages[0]; //works
document.pages.remove(page); //exception occurs here, removeAt() doesn't work either
File file = File(path);
file.writeAsBytesSync(document.saveSync());
document.dispose();`
This is the exception:
Unhandled Exception: Null check operator used on a null value
#0 PdfDocumentHelper.createBookmarkDestinationDictionary (package:syncfusion_flutter_pdf/src/pdf/implementation/pdf_document/pdf_document.dart:1370:38)
#1 PdfPageCollection._removePage (package:syncfusion_flutter_pdf/src/pdf/implementation/pages/pdf_page_collection.dart:567:16)
#2 PdfPageCollection.remove (package:syncfusion_flutter_pdf/src/pdf/implementation/pages/pdf_page_collection.dart:207:5)
#3 QisConnector._getDiplomaSupplementFile (package:pa_pdf_crawler/data/qis_connector.dart:137:24)
#4 QisConnector.getDiplomaSupplement (package:pa_pdf_crawler/data/qis_connector.dart:156:27)
#5 Functions.loadAllDocuments (package:pa_pdf_crawler/data/functions.dart:21:9)
#6 _MassPrintState.build. (package:pa_pdf_crawler/presentation/mass_print.dart:116:28)
Does anyone know how to solve this?