output method

  1. @override
void output(
  1. PdfObjectBase<PdfDataType> o,
  2. PdfStream s, [
  3. int? indent
])

Implementation

@override
void output(PdfObjectBase o, PdfStream s, [int? indent]) {
  assert(value[0] == '/');
  final bytes = <int>[];
  for (final c in value.codeUnits) {
    assert(c < 0xff && c > 0x00);

    if (c < 0x21 ||
        c > 0x7E ||
        c == 0x23 ||
        (c == 0x2f && bytes.isNotEmpty) ||
        c == 0x5b ||
        c == 0x5d ||
        c == 0x28 ||
        c == 0x3c ||
        c == 0x3e) {
      bytes.add(0x23);
      final x = c.toRadixString(16).padLeft(2, '0');
      bytes.addAll(x.codeUnits);
    } else {
      bytes.add(c);
    }
  }
  s.putBytes(bytes);
}