David PHAM-VAN

Preliminary support for compressed objects

@@ -20,7 +20,7 @@ import 'data_types.dart'; @@ -20,7 +20,7 @@ import 'data_types.dart';
20 import 'obj/object.dart'; 20 import 'obj/object.dart';
21 import 'stream.dart'; 21 import 'stream.dart';
22 22
23 -enum PdfCrossRefEntryType { free, inUse } 23 +enum PdfCrossRefEntryType { free, inUse, compressed }
24 24
25 /// Cross-reference for a Pdf Object 25 /// Cross-reference for a Pdf Object
26 class PdfXref { 26 class PdfXref {
@@ -29,6 +29,7 @@ class PdfXref { @@ -29,6 +29,7 @@ class PdfXref {
29 this.id, 29 this.id,
30 this.offset, { 30 this.offset, {
31 this.generation = 0, 31 this.generation = 0,
  32 + this.object,
32 this.type = PdfCrossRefEntryType.inUse, 33 this.type = PdfCrossRefEntryType.inUse,
33 }); 34 });
34 35
@@ -38,6 +39,9 @@ class PdfXref { @@ -38,6 +39,9 @@ class PdfXref {
38 /// The offset within the Pdf file 39 /// The offset within the Pdf file
39 final int offset; 40 final int offset;
40 41
  42 + /// The object ID containing this compressed object
  43 + final int? object;
  44 +
41 /// The generation of the object, usually 0 45 /// The generation of the object, usually 0
42 final int generation; 46 final int generation;
43 47
@@ -51,6 +55,8 @@ class PdfXref { @@ -51,6 +55,8 @@ class PdfXref {
51 (type == PdfCrossRefEntryType.inUse ? ' n ' : ' f '); 55 (type == PdfCrossRefEntryType.inUse ? ' n ' : ' f ');
52 } 56 }
53 57
  58 + PdfIndirect? get container => object == null ? null : PdfIndirect(object!, 0);
  59 +
54 /// The xref in the format of the compressed xref section in the Pdf file 60 /// The xref in the format of the compressed xref section in the Pdf file
55 int cref(ByteData o, int ofs, List<int> w) { 61 int cref(ByteData o, int ofs, List<int> w) {
56 assert(w.length >= 3); 62 assert(w.length >= 3);