DavBfr / dart_pdf

Pdf creation module for dart/flutter
https://pub.dev/packages/pdf
Apache License 2.0
1.42k stars 633 forks source link

excuse me! how to load a exist pdf file? #1733

Closed taihangg closed 2 months ago

taihangg commented 2 months ago

excuse me! how to load a exist pdf file?

DavBfr commented 2 months ago

To do what?

taihangg commented 2 months ago

To do what? I want to load a pdf file,then remove some pages and save it.

DavBfr commented 2 months ago

That would be something like:

final tools = PdfTools();

final parsed = PdfDocumentParser(await File('doc1.pdf').readAsBytes());
tools.addPages(parsed, [1, 3, 5, 6, 7]);
final result = tools.save();

final file = File('updated.pdf');
await file.writeAsBytes(result);

Using: https://pub.nfet.net/pdf_crypto/

taihangg commented 2 months ago

ok, thank you! I just try a toolkit, so i think it's a little expensive. Thank you !