rewriteBytes method
Rewrites the bytes of a PDF.
The file is read with repair enabled, so a damaged xref can still be rewritten — and the rewrite fixes the table, because the output is written from scratch.
Implementation
Future<PdfRewriteResult> rewriteBytes(
Uint8List bytes, {
bool useIsolate = false,
}) {
final source = PdfDocumentParser(bytes, allowRepair: true);
return rewriteDocument(
source,
bytesBefore: bytes.length,
useIsolate: useIsolate,
);
}