@pdfme/pdf-lib 6.0.3 → 6.0.4-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src/api/Embeddable.ts → dist/api/Embeddable.d.ts} +1 -1
- package/dist/api/PDFDocument.d.ts +778 -0
- package/dist/api/PDFDocumentOptions.d.ts +38 -0
- package/dist/api/PDFEmbeddedFile.d.ts +38 -0
- package/dist/api/PDFEmbeddedPage.d.ts +73 -0
- package/dist/api/PDFFont.d.ts +94 -0
- package/dist/api/PDFImage.d.ts +95 -0
- package/dist/api/PDFJavaScript.d.ts +38 -0
- package/dist/api/PDFPage.d.ts +910 -0
- package/dist/api/PDFPageOptions.d.ts +172 -0
- package/dist/api/StandardFonts.d.ts +16 -0
- package/dist/api/colors.d.ts +34 -0
- package/dist/api/errors.d.ts +42 -0
- package/dist/api/form/PDFButton.d.ts +137 -0
- package/dist/api/form/PDFCheckBox.d.ts +142 -0
- package/dist/api/form/PDFDropdown.d.ts +402 -0
- package/dist/api/form/PDFField.d.ts +203 -0
- package/dist/api/form/PDFForm.d.ts +411 -0
- package/dist/api/form/PDFOptionList.d.ts +335 -0
- package/dist/api/form/PDFRadioGroup.d.ts +252 -0
- package/dist/api/form/PDFSignature.d.ts +29 -0
- package/dist/api/form/PDFTextField.d.ts +537 -0
- package/dist/api/form/appearances.d.ts +41 -0
- package/dist/api/image/alignment.d.ts +5 -0
- package/dist/api/objects.d.ts +4 -0
- package/dist/api/operations.d.ts +226 -0
- package/dist/api/operators.d.ts +90 -0
- package/dist/api/rotations.d.ts +38 -0
- package/dist/api/sizes.d.ts +52 -0
- package/dist/api/svg.d.ts +70 -0
- package/dist/api/svgPath.d.ts +2 -0
- package/dist/api/text/alignment.d.ts +5 -0
- package/dist/api/text/layout.d.ts +54 -0
- package/dist/core/PDFContext.d.ts +84 -0
- package/dist/core/PDFObjectCopier.d.ts +37 -0
- package/dist/core/acroform/PDFAcroButton.d.ts +21 -0
- package/dist/core/acroform/PDFAcroCheckBox.d.ts +13 -0
- package/dist/core/acroform/PDFAcroChoice.d.ts +20 -0
- package/dist/core/acroform/PDFAcroComboBox.d.ts +9 -0
- package/dist/core/acroform/PDFAcroField.d.ts +36 -0
- package/dist/core/acroform/PDFAcroForm.d.ts +20 -0
- package/dist/core/acroform/PDFAcroListBox.d.ts +9 -0
- package/dist/core/acroform/PDFAcroNonTerminal.d.ts +13 -0
- package/dist/core/acroform/PDFAcroPushButton.d.ts +9 -0
- package/dist/core/acroform/PDFAcroRadioButton.d.ts +13 -0
- package/{src/core/acroform/PDFAcroSignature.ts → dist/core/acroform/PDFAcroSignature.d.ts} +2 -4
- package/dist/core/acroform/PDFAcroTerminal.d.ts +16 -0
- package/dist/core/acroform/PDFAcroText.d.ts +22 -0
- package/dist/core/acroform/flags.d.ts +141 -0
- package/dist/core/acroform/utils.d.ts +6 -0
- package/dist/core/annotation/AppearanceCharacteristics.d.ts +33 -0
- package/dist/core/annotation/BorderStyle.d.ts +11 -0
- package/dist/core/annotation/PDFAnnotation.d.ts +51 -0
- package/dist/core/annotation/PDFWidgetAnnotation.d.ts +26 -0
- package/dist/core/annotation/flags.d.ts +79 -0
- package/dist/core/crypto.d.ts +95 -0
- package/dist/core/document/PDFCrossRefSection.d.ts +27 -0
- package/dist/core/document/PDFHeader.d.ts +10 -0
- package/dist/core/document/PDFTrailer.d.ts +9 -0
- package/dist/core/document/PDFTrailerDict.d.ts +10 -0
- package/dist/core/embedders/CMap.d.ts +3 -0
- package/dist/core/embedders/CustomFontEmbedder.d.ts +44 -0
- package/dist/core/embedders/CustomFontSubsetEmbedder.d.ts +20 -0
- package/dist/core/embedders/FileEmbedder.d.ts +33 -0
- package/dist/core/embedders/FontFlags.d.ts +13 -0
- package/dist/core/embedders/JavaScriptEmbedder.d.ts +10 -0
- package/dist/core/embedders/JpegEmbedder.d.ts +23 -0
- package/dist/core/embedders/PDFPageEmbedder.d.ts +37 -0
- package/dist/core/embedders/PngEmbedder.d.ts +19 -0
- package/dist/core/embedders/StandardFontEmbedder.d.ts +36 -0
- package/dist/core/errors.d.ts +94 -0
- package/{src/core/index.ts → dist/core/index.d.ts} +1 -17
- package/dist/core/interactive/ViewerPreferences.d.ts +347 -0
- package/dist/core/objects/PDFArray.d.ts +63 -0
- package/dist/core/objects/PDFBool.d.ts +13 -0
- package/dist/core/objects/PDFDict.d.ts +62 -0
- package/dist/core/objects/PDFHexString.d.ts +16 -0
- package/dist/core/objects/PDFInvalidObject.d.ts +11 -0
- package/dist/core/objects/PDFName.d.ts +41 -0
- package/dist/core/objects/PDFNull.d.ts +10 -0
- package/dist/core/objects/PDFNumber.d.ts +15 -0
- package/dist/core/objects/PDFObject.d.ts +8 -0
- package/dist/core/objects/PDFRawStream.d.ts +16 -0
- package/dist/core/objects/PDFRef.d.ts +13 -0
- package/dist/core/objects/PDFStream.d.ts +16 -0
- package/dist/core/objects/PDFString.d.ts +16 -0
- package/dist/core/operators/PDFOperator.d.ts +19 -0
- package/dist/core/operators/PDFOperatorNames.d.ts +76 -0
- package/dist/core/parser/BaseParser.d.ts +14 -0
- package/dist/core/parser/ByteStream.d.ts +26 -0
- package/dist/core/parser/PDFObjectParser.d.ts +31 -0
- package/dist/core/parser/PDFObjectStreamParser.d.ts +13 -0
- package/dist/core/parser/PDFParser.d.ts +46 -0
- package/dist/core/parser/PDFXRefStreamParser.d.ts +21 -0
- package/dist/core/streams/Ascii85Stream.d.ts +9 -0
- package/dist/core/streams/AsciiHexStream.d.ts +9 -0
- package/dist/core/streams/DecodeStream.d.ts +26 -0
- package/dist/core/streams/DecryptStream.d.ts +12 -0
- package/dist/core/streams/FlateStream.d.ts +13 -0
- package/dist/core/streams/LZWStream.d.ts +12 -0
- package/dist/core/streams/RunLengthStream.d.ts +8 -0
- package/dist/core/streams/Stream.d.ts +34 -0
- package/dist/core/streams/decode.d.ts +3 -0
- package/dist/core/structures/PDFCatalog.d.ts +27 -0
- package/dist/core/structures/PDFContentStream.d.ts +15 -0
- package/dist/core/structures/PDFCrossRefStream.d.ts +53 -0
- package/dist/core/structures/PDFFlateStream.d.ts +13 -0
- package/dist/core/structures/PDFObjectStream.d.ts +20 -0
- package/dist/core/structures/PDFPageLeaf.d.ts +54 -0
- package/dist/core/structures/PDFPageTree.d.ts +41 -0
- package/dist/core/syntax/CharCodes.d.ts +61 -0
- package/dist/core/syntax/Delimiters.d.ts +1 -0
- package/dist/core/syntax/Irregular.d.ts +1 -0
- package/dist/core/syntax/Keywords.d.ts +22 -0
- package/dist/core/syntax/Numeric.d.ts +3 -0
- package/dist/core/syntax/Whitespace.d.ts +1 -0
- package/dist/core/writers/PDFStreamWriter.d.ts +19 -0
- package/dist/core/writers/PDFWriter.d.ts +29 -0
- package/dist/index.js +19124 -0
- package/dist/index.js.map +1 -0
- package/dist/types/fontkit.d.ts +597 -0
- package/{src/types/index.ts → dist/types/index.d.ts} +8 -13
- package/{src/types/matrix.ts → dist/types/matrix.d.ts} +1 -2
- package/dist/utils/Cache.d.ts +10 -0
- package/dist/utils/arrays.d.ts +16 -0
- package/dist/utils/async.d.ts +5 -0
- package/dist/utils/base64.d.ts +10 -0
- package/dist/utils/elements/Arc.d.ts +22 -0
- package/dist/utils/elements/Circle.d.ts +14 -0
- package/dist/utils/elements/Ellipse.d.ts +20 -0
- package/dist/utils/elements/GraphElement.d.ts +6 -0
- package/dist/utils/elements/Line.d.ts +23 -0
- package/dist/utils/elements/Plot.d.ts +11 -0
- package/dist/utils/elements/Point.d.ts +18 -0
- package/dist/utils/elements/Rectangle.d.ts +21 -0
- package/dist/utils/elements/Segment.d.ts +19 -0
- package/dist/utils/errors.d.ts +1 -0
- package/dist/utils/intersections.d.ts +9 -0
- package/dist/utils/maths.d.ts +45 -0
- package/dist/utils/numbers.d.ts +23 -0
- package/dist/utils/objects.d.ts +15 -0
- package/dist/utils/pdfDocEncoding.d.ts +7 -0
- package/dist/utils/png.d.ts +17 -0
- package/dist/utils/rng.d.ts +13 -0
- package/dist/utils/strings.d.ts +25 -0
- package/{src/utils/unicode.ts → dist/utils/unicode.d.ts} +8 -195
- package/dist/utils/validators.d.ts +26 -0
- package/package.json +6 -1
- package/__tests__/api/PDFDocument.spec.ts +0 -576
- package/__tests__/api/PDFImage.spec.ts +0 -60
- package/__tests__/api/PDFPage.spec.ts +0 -151
- package/__tests__/api/form/PDFCheckBox.spec.ts +0 -71
- package/__tests__/api/form/PDFDropdown.spec.ts +0 -118
- package/__tests__/api/form/PDFForm.spec.ts +0 -370
- package/__tests__/api/form/PDFOptionList.spec.ts +0 -104
- package/__tests__/api/form/PDFRadioGroup.spec.ts +0 -183
- package/__tests__/api/form/PDFTextField.spec.ts +0 -148
- package/__tests__/api/svgPath.spec.ts +0 -153
- package/__tests__/api/text/layout.spec.ts +0 -166
- package/__tests__/core/PDFContext.spec.ts +0 -194
- package/__tests__/core/PDFObjectCopier.spec.ts +0 -421
- package/__tests__/core/acroform/PDFAcroField.spec.ts +0 -98
- package/__tests__/core/acroform/PDFAcroTerminal.spec.ts +0 -39
- package/__tests__/core/annotation/PDFWidgetAnnotation.spec.ts +0 -40
- package/__tests__/core/document/PDFCrossRefSection.spec.ts +0 -88
- package/__tests__/core/document/PDFHeader.spec.ts +0 -22
- package/__tests__/core/document/PDFTrailer.spec.ts +0 -28
- package/__tests__/core/document/PDFTrailerDict.spec.ts +0 -24
- package/__tests__/core/embedders/CMap.spec.ts +0 -47
- package/__tests__/core/embedders/CustomFontEmbedder.spec.ts +0 -96
- package/__tests__/core/embedders/CustomFontSubsetEmbedder.spec.ts +0 -62
- package/__tests__/core/embedders/FileEmbedder.spec.ts +0 -54
- package/__tests__/core/embedders/JpegEmbedder.spec.ts +0 -67
- package/__tests__/core/embedders/PDFPageEmbedder.spec.ts +0 -65
- package/__tests__/core/embedders/PngEmbedder.spec.ts +0 -87
- package/__tests__/core/embedders/StandardFontEmbedder.spec.ts +0 -79
- package/__tests__/core/embedders/data/SourceHanSerifJP-Regular.otf.cmap +0 -16096
- package/__tests__/core/embedders/data/Ubuntu-R.ttf.cmap +0 -1211
- package/__tests__/core/objects/PDFArray.spec.ts +0 -134
- package/__tests__/core/objects/PDFBool.spec.ts +0 -42
- package/__tests__/core/objects/PDFDict.spec.ts +0 -195
- package/__tests__/core/objects/PDFHexString.spec.ts +0 -168
- package/__tests__/core/objects/PDFInvalidObject.spec.ts +0 -32
- package/__tests__/core/objects/PDFName.spec.ts +0 -122
- package/__tests__/core/objects/PDFNull.spec.ts +0 -30
- package/__tests__/core/objects/PDFNumber.spec.ts +0 -50
- package/__tests__/core/objects/PDFObject.spec.ts +0 -29
- package/__tests__/core/objects/PDFRawStream.spec.ts +0 -45
- package/__tests__/core/objects/PDFRef.spec.ts +0 -60
- package/__tests__/core/objects/PDFString.spec.ts +0 -237
- package/__tests__/core/operators/PDFOperator.spec.ts +0 -77
- package/__tests__/core/parser/PDFObjectParser.spec.ts +0 -730
- package/__tests__/core/parser/PDFObjectStreamParser.spec.ts +0 -158
- package/__tests__/core/parser/PDFParser.spec.ts +0 -398
- package/__tests__/core/parser/PDFXRefStreamParser.spec.ts +0 -187
- package/__tests__/core/parser/data/object-stream-invalid +0 -2
- package/__tests__/core/parser/data/object-stream1 +0 -16
- package/__tests__/core/parser/data/object-stream2 +0 -10
- package/__tests__/core/parser/data/object-stream3 +0 -0
- package/__tests__/core/parser/data/object-stream4 +0 -0
- package/__tests__/core/parser/data/xref-stream1 +0 -0
- package/__tests__/core/parser/data/xref-stream2 +0 -0
- package/__tests__/core/parser/data/xref-stream3 +0 -0
- package/__tests__/core/parser/data/xref-stream4 +0 -0
- package/__tests__/core/streams/Ascii85Stream.spec.ts +0 -20
- package/__tests__/core/streams/AsciiHexStream.spec.ts +0 -20
- package/__tests__/core/streams/FlateStream.spec.ts +0 -20
- package/__tests__/core/streams/LZWStream.spec.ts +0 -20
- package/__tests__/core/streams/RunLengthStream.spec.ts +0 -20
- package/__tests__/core/streams/Stream.spec.ts +0 -128
- package/__tests__/core/streams/data/ascii85/1.decoded +0 -0
- package/__tests__/core/streams/data/ascii85/1.encoded +0 -43
- package/__tests__/core/streams/data/asciihex/1.decoded +0 -1
- package/__tests__/core/streams/data/asciihex/1.encoded +0 -1
- package/__tests__/core/streams/data/asciihex/2.decoded +0 -7
- package/__tests__/core/streams/data/asciihex/2.encoded +0 -1
- package/__tests__/core/streams/data/flate/1.corrupt.encoded +0 -1
- package/__tests__/core/streams/data/flate/1.decoded +0 -0
- package/__tests__/core/streams/data/flate/1.encoded +0 -2
- package/__tests__/core/streams/data/flate/2.decoded +0 -33
- package/__tests__/core/streams/data/flate/2.encoded +0 -0
- package/__tests__/core/streams/data/flate/3.decoded +0 -15
- package/__tests__/core/streams/data/flate/3.encoded +0 -0
- package/__tests__/core/streams/data/flate/4.decoded +0 -16
- package/__tests__/core/streams/data/flate/4.encoded +0 -0
- package/__tests__/core/streams/data/flate/5.decoded +0 -0
- package/__tests__/core/streams/data/flate/5.encoded +0 -0
- package/__tests__/core/streams/data/flate/6.decoded +0 -17
- package/__tests__/core/streams/data/flate/6.encoded +0 -0
- package/__tests__/core/streams/data/flate/7.decoded +0 -20
- package/__tests__/core/streams/data/flate/7.encoded +0 -1
- package/__tests__/core/streams/data/lzw/1.decoded +0 -0
- package/__tests__/core/streams/data/lzw/1.encoded +0 -0
- package/__tests__/core/streams/data/lzw/2.decoded +0 -0
- package/__tests__/core/streams/data/lzw/2.encoded +0 -0
- package/__tests__/core/streams/data/lzw/3.decoded +0 -14
- package/__tests__/core/streams/data/lzw/3.encoded +0 -2
- package/__tests__/core/streams/data/lzw/4.decoded +0 -14
- package/__tests__/core/streams/data/lzw/4.encoded +0 -2
- package/__tests__/core/streams/data/runlength/1.decoded +0 -1
- package/__tests__/core/streams/data/runlength/1.encoded +0 -1
- package/__tests__/core/streams/data/runlength/2.decoded +0 -1
- package/__tests__/core/streams/data/runlength/2.encoded +0 -1
- package/__tests__/core/streams/data/runlength/3.decoded +0 -0
- package/__tests__/core/streams/data/runlength/3.encoded +0 -0
- package/__tests__/core/streams/data/runlength/4.decoded +0 -1
- package/__tests__/core/streams/data/runlength/4.encoded +0 -1
- package/__tests__/core/streams/data/runlength/5.decoded +0 -1
- package/__tests__/core/streams/data/runlength/5.encoded +0 -1
- package/__tests__/core/streams/data/runlength/empty.encoded +0 -1
- package/__tests__/core/structures/PDFCatalog.spec.ts +0 -108
- package/__tests__/core/structures/PDFContentStream.spec.ts +0 -117
- package/__tests__/core/structures/PDFCrossRefStream.spec.ts +0 -145
- package/__tests__/core/structures/PDFObjectStream.spec.ts +0 -138
- package/__tests__/core/structures/PDFPageLeaf.spec.ts +0 -355
- package/__tests__/core/structures/PDFPageTree.spec.ts +0 -592
- package/__tests__/core/writers/PDFStreamWriter.spec.ts +0 -71
- package/__tests__/core/writers/PDFWriter.spec.ts +0 -144
- package/__tests__/core/writers/data/stream-writer-1.pdf +0 -0
- package/__tests__/index.test.ts +0 -12
- package/__tests__/utils/base64.spec.ts +0 -61
- package/__tests__/utils/data/simple.pdf +0 -201
- package/__tests__/utils/data/simple.pdf.base64 +0 -1
- package/__tests__/utils/pdfDocEncoding.spec.ts +0 -82
- package/__tests__/utils/png.spec.ts +0 -53
- package/__tests__/utils/rng.spec.ts +0 -14
- package/__tests__/utils/strings.spec.ts +0 -98
- package/__tests__/utils/unicode.spec.ts +0 -337
- package/assets/fonts/source_hans_jp/SourceHanSerifJP-Regular.otf +0 -0
- package/assets/fonts/ubuntu/Ubuntu-B.ttf +0 -0
- package/assets/fonts/ubuntu/Ubuntu-R.ttf +0 -0
- package/assets/images/cat_riding_unicorn.jpg +0 -0
- package/assets/images/cmyk_colorspace.jpg +0 -0
- package/assets/images/greyscale_bird.png +0 -0
- package/assets/images/minions_banana_alpha.png +0 -0
- package/assets/images/minions_banana_no_alpha.png +0 -0
- package/assets/images/minions_laughing.jpg +0 -0
- package/assets/pdfs/bixby_guide.pdf +0 -0
- package/assets/pdfs/encrypted_new.pdf +0 -0
- package/assets/pdfs/encrypted_old.pdf +0 -0
- package/assets/pdfs/fancy_fields.pdf +0 -0
- package/assets/pdfs/giraffe.pdf +0 -0
- package/assets/pdfs/invalid_root_ref.pdf +0 -0
- package/assets/pdfs/just_metadata.pdf +0 -49
- package/assets/pdfs/missing_endobj_keyword.pdf +0 -70
- package/assets/pdfs/missing_xref_trailer_dict.pdf +0 -141
- package/assets/pdfs/normal.pdf +0 -0
- package/assets/pdfs/pdf20examples/PDF 2.0 with offset start.pdf +0 -179
- package/assets/pdfs/stuff_following_header.pdf +0 -0
- package/assets/pdfs/us_constitution.pdf +0 -0
- package/assets/pdfs/with_comments.pdf +0 -0
- package/assets/pdfs/with_invalid_objects.pdf +0 -53
- package/assets/pdfs/with_invalid_stream_EOL.pdf +0 -0
- package/assets/pdfs/with_null_parent_entry.pdf +0 -0
- package/assets/pdfs/with_signature.pdf +0 -0
- package/assets/pdfs/with_update_sections.pdf +0 -0
- package/assets/pdfs/with_viewer_prefs.pdf +0 -0
- package/assets/pdfs/with_xfa_fields.pdf +0 -0
- package/src/api/PDFDocument.ts +0 -1389
- package/src/api/PDFDocumentOptions.ts +0 -45
- package/src/api/PDFEmbeddedFile.ts +0 -87
- package/src/api/PDFEmbeddedPage.ts +0 -100
- package/src/api/PDFFont.ts +0 -149
- package/src/api/PDFImage.ts +0 -143
- package/src/api/PDFJavaScript.ts +0 -75
- package/src/api/PDFPage.ts +0 -1604
- package/src/api/PDFPageOptions.ts +0 -175
- package/src/api/StandardFonts.ts +0 -16
- package/src/api/colors.ts +0 -109
- package/src/api/errors.ts +0 -110
- package/src/api/form/PDFButton.ts +0 -242
- package/src/api/form/PDFCheckBox.ts +0 -247
- package/src/api/form/PDFDropdown.ts +0 -637
- package/src/api/form/PDFField.ts +0 -491
- package/src/api/form/PDFForm.ts +0 -842
- package/src/api/form/PDFOptionList.ts +0 -555
- package/src/api/form/PDFRadioGroup.ts +0 -455
- package/src/api/form/PDFSignature.ts +0 -44
- package/src/api/form/PDFTextField.ts +0 -811
- package/src/api/form/appearances.ts +0 -655
- package/src/api/image/alignment.ts +0 -5
- package/src/api/objects.ts +0 -10
- package/src/api/operations.ts +0 -873
- package/src/api/operators.ts +0 -335
- package/src/api/rotations.ts +0 -84
- package/src/api/sizes.ts +0 -52
- package/src/api/svg.ts +0 -888
- package/src/api/svgPath.ts +0 -460
- package/src/api/text/alignment.ts +0 -5
- package/src/api/text/layout.ts +0 -328
- package/src/core/PDFContext.ts +0 -274
- package/src/core/PDFObjectCopier.ts +0 -142
- package/src/core/acroform/PDFAcroButton.ts +0 -104
- package/src/core/acroform/PDFAcroCheckBox.ts +0 -48
- package/src/core/acroform/PDFAcroChoice.ts +0 -143
- package/src/core/acroform/PDFAcroComboBox.ts +0 -21
- package/src/core/acroform/PDFAcroField.ts +0 -168
- package/src/core/acroform/PDFAcroForm.ts +0 -96
- package/src/core/acroform/PDFAcroListBox.ts +0 -19
- package/src/core/acroform/PDFAcroNonTerminal.ts +0 -33
- package/src/core/acroform/PDFAcroPushButton.ts +0 -21
- package/src/core/acroform/PDFAcroRadioButton.ts +0 -57
- package/src/core/acroform/PDFAcroTerminal.ts +0 -70
- package/src/core/acroform/PDFAcroText.ts +0 -76
- package/src/core/acroform/flags.ts +0 -162
- package/src/core/acroform/utils.ts +0 -129
- package/src/core/annotation/AppearanceCharacteristics.ts +0 -133
- package/src/core/annotation/BorderStyle.ts +0 -31
- package/src/core/annotation/PDFAnnotation.ts +0 -148
- package/src/core/annotation/PDFWidgetAnnotation.ts +0 -111
- package/src/core/annotation/flags.ts +0 -90
- package/src/core/crypto.ts +0 -1844
- package/src/core/document/PDFCrossRefSection.ts +0 -161
- package/src/core/document/PDFHeader.ts +0 -48
- package/src/core/document/PDFTrailer.ts +0 -48
- package/src/core/document/PDFTrailerDict.ts +0 -39
- package/src/core/embedders/CMap.ts +0 -65
- package/src/core/embedders/CustomFontEmbedder.ts +0 -237
- package/src/core/embedders/CustomFontSubsetEmbedder.ts +0 -89
- package/src/core/embedders/FileEmbedder.ts +0 -77
- package/src/core/embedders/FontFlags.ts +0 -45
- package/src/core/embedders/JavaScriptEmbedder.ts +0 -34
- package/src/core/embedders/JpegEmbedder.ts +0 -118
- package/src/core/embedders/PDFPageEmbedder.ts +0 -139
- package/src/core/embedders/PngEmbedder.ts +0 -69
- package/src/core/embedders/StandardFontEmbedder.ts +0 -121
- package/src/core/errors.ts +0 -226
- package/src/core/interactive/ViewerPreferences.ts +0 -565
- package/src/core/objects/PDFArray.ts +0 -179
- package/src/core/objects/PDFBool.ts +0 -53
- package/src/core/objects/PDFDict.ts +0 -220
- package/src/core/objects/PDFHexString.ts +0 -94
- package/src/core/objects/PDFInvalidObject.ts +0 -34
- package/src/core/objects/PDFName.ts +0 -152
- package/src/core/objects/PDFNull.ts +0 -30
- package/src/core/objects/PDFNumber.ts +0 -44
- package/src/core/objects/PDFObject.ts +0 -22
- package/src/core/objects/PDFRawStream.ts +0 -41
- package/src/core/objects/PDFRef.ts +0 -51
- package/src/core/objects/PDFStream.ts +0 -87
- package/src/core/objects/PDFString.ts +0 -118
- package/src/core/operators/PDFOperator.ts +0 -72
- package/src/core/operators/PDFOperatorNames.ts +0 -92
- package/src/core/parser/BaseParser.ts +0 -119
- package/src/core/parser/ByteStream.ts +0 -76
- package/src/core/parser/PDFObjectParser.ts +0 -302
- package/src/core/parser/PDFObjectStreamParser.ts +0 -65
- package/src/core/parser/PDFParser.ts +0 -363
- package/src/core/parser/PDFXRefStreamParser.ts +0 -129
- package/src/core/streams/Ascii85Stream.ts +0 -97
- package/src/core/streams/AsciiHexStream.ts +0 -77
- package/src/core/streams/DecodeStream.ts +0 -188
- package/src/core/streams/DecryptStream.ts +0 -49
- package/src/core/streams/FlateStream.ts +0 -397
- package/src/core/streams/LZWStream.ts +0 -157
- package/src/core/streams/RunLengthStream.ts +0 -55
- package/src/core/streams/Stream.ts +0 -126
- package/src/core/streams/decode.ts +0 -70
- package/src/core/structures/PDFCatalog.ts +0 -81
- package/src/core/structures/PDFContentStream.ts +0 -58
- package/src/core/structures/PDFCrossRefStream.ts +0 -238
- package/src/core/structures/PDFFlateStream.ts +0 -40
- package/src/core/structures/PDFObjectStream.ts +0 -91
- package/src/core/structures/PDFPageLeaf.ts +0 -244
- package/src/core/structures/PDFPageTree.ts +0 -192
- package/src/core/syntax/CharCodes.ts +0 -62
- package/src/core/syntax/Delimiters.ts +0 -14
- package/src/core/syntax/Irregular.ts +0 -10
- package/src/core/syntax/Keywords.ts +0 -57
- package/src/core/syntax/Numeric.ts +0 -26
- package/src/core/syntax/Whitespace.ts +0 -10
- package/src/core/writers/PDFStreamWriter.ts +0 -114
- package/src/core/writers/PDFWriter.ts +0 -146
- package/src/types/fontkit.ts +0 -643
- package/src/utils/Cache.ts +0 -26
- package/src/utils/arrays.ts +0 -153
- package/src/utils/async.ts +0 -8
- package/src/utils/base64.ts +0 -98
- package/src/utils/elements/Arc.ts +0 -97
- package/src/utils/elements/Circle.ts +0 -47
- package/src/utils/elements/Ellipse.ts +0 -117
- package/src/utils/elements/GraphElement.ts +0 -14
- package/src/utils/elements/Line.ts +0 -83
- package/src/utils/elements/Plot.ts +0 -50
- package/src/utils/elements/Point.ts +0 -37
- package/src/utils/elements/Rectangle.ts +0 -65
- package/src/utils/elements/Segment.ts +0 -81
- package/src/utils/errors.ts +0 -3
- package/src/utils/intersections.ts +0 -237
- package/src/utils/maths.ts +0 -96
- package/src/utils/numbers.ts +0 -55
- package/src/utils/objects.ts +0 -13
- package/src/utils/pdfDocEncoding.ts +0 -69
- package/src/utils/png.ts +0 -100
- package/src/utils/rng.ts +0 -21
- package/src/utils/strings.ts +0 -191
- package/src/utils/validators.ts +0 -192
- package/tsconfig.build.json +0 -14
- package/tsconfig.json +0 -15
- package/vite.config.mts +0 -39
- /package/{src/api/form/index.ts → dist/api/form/index.d.ts} +0 -0
- /package/{src/api/image/index.ts → dist/api/image/index.d.ts} +0 -0
- /package/{src/api/index.ts → dist/api/index.d.ts} +0 -0
- /package/{src/api/text/index.ts → dist/api/text/index.d.ts} +0 -0
- /package/{src/core/acroform/index.ts → dist/core/acroform/index.d.ts} +0 -0
- /package/{src/core/annotation/index.ts → dist/core/annotation/index.d.ts} +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src/utils/elements/index.ts → dist/utils/elements/index.d.ts} +0 -0
- /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PDFArray,
|
|
3
|
-
PDFBool,
|
|
4
|
-
PDFContext,
|
|
5
|
-
PDFDict,
|
|
6
|
-
PDFHexString,
|
|
7
|
-
PDFName,
|
|
8
|
-
PDFNull,
|
|
9
|
-
PDFNumber,
|
|
10
|
-
PDFRef,
|
|
11
|
-
PDFString,
|
|
12
|
-
} from '../../../src/core';
|
|
13
|
-
import { toCharCode, typedArrayFor } from '../../../src/utils';
|
|
14
|
-
|
|
15
|
-
describe(`PDFArray`, () => {
|
|
16
|
-
const context = PDFContext.create();
|
|
17
|
-
|
|
18
|
-
it(`can be constructed with PDFArray.withContext(...)`, () => {
|
|
19
|
-
expect(PDFArray.withContext(context)).toBeInstanceOf(PDFArray);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const pdfArray = PDFArray.withContext(context);
|
|
23
|
-
|
|
24
|
-
const pdfBool = PDFBool.True;
|
|
25
|
-
const pdfHexString = PDFHexString.of('ABC123');
|
|
26
|
-
const pdfName = PDFName.of('Foo#Bar!');
|
|
27
|
-
const pdfNull = PDFNull;
|
|
28
|
-
const pdfNumber = PDFNumber.of(-24.179);
|
|
29
|
-
const pdfString = PDFString.of('foobar');
|
|
30
|
-
|
|
31
|
-
const pdfSubDict = PDFDict.withContext(context);
|
|
32
|
-
pdfSubDict.set(PDFName.of('Foo'), PDFName.of('Bar'));
|
|
33
|
-
|
|
34
|
-
const pdfSubArray = PDFArray.withContext(context);
|
|
35
|
-
pdfSubArray.push(PDFBool.True);
|
|
36
|
-
pdfSubArray.push(pdfSubDict);
|
|
37
|
-
|
|
38
|
-
const pdfRef = PDFRef.of(21, 92);
|
|
39
|
-
|
|
40
|
-
pdfArray.push(pdfBool);
|
|
41
|
-
pdfArray.push(pdfHexString);
|
|
42
|
-
pdfArray.push(pdfName);
|
|
43
|
-
pdfArray.push(pdfNull);
|
|
44
|
-
pdfArray.push(pdfNumber);
|
|
45
|
-
pdfArray.push(pdfString);
|
|
46
|
-
pdfArray.push(pdfSubArray);
|
|
47
|
-
pdfArray.push(pdfRef);
|
|
48
|
-
|
|
49
|
-
it(`retains pushed objects`, () => {
|
|
50
|
-
expect(pdfArray.size()).toBe(8);
|
|
51
|
-
|
|
52
|
-
expect(pdfArray.get(0)).toBe(pdfBool);
|
|
53
|
-
expect(pdfArray.get(1)).toBe(pdfHexString);
|
|
54
|
-
expect(pdfArray.get(2)).toBe(pdfName);
|
|
55
|
-
expect(pdfArray.get(3)).toBe(pdfNull);
|
|
56
|
-
expect(pdfArray.get(4)).toBe(pdfNumber);
|
|
57
|
-
expect(pdfArray.get(5)).toBe(pdfString);
|
|
58
|
-
expect(pdfArray.get(6)).toBe(pdfSubArray);
|
|
59
|
-
expect(pdfArray.get(7)).toBe(pdfRef);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it(`allows objects to be assigned to specific indices`, () => {
|
|
63
|
-
const array = PDFArray.withContext(PDFContext.create());
|
|
64
|
-
array.push(PDFName.of('a'));
|
|
65
|
-
array.push(PDFName.of('b'));
|
|
66
|
-
array.push(PDFName.of('c'));
|
|
67
|
-
array.set(1, PDFName.of('z'));
|
|
68
|
-
expect(array.get(1)).toBe(PDFName.of('z'));
|
|
69
|
-
expect(array.size()).toBe(3);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it(`allows objects to be inserted at specific indices`, () => {
|
|
73
|
-
const array = PDFArray.withContext(PDFContext.create());
|
|
74
|
-
array.push(PDFName.of('a'));
|
|
75
|
-
array.push(PDFName.of('b'));
|
|
76
|
-
array.push(PDFName.of('c'));
|
|
77
|
-
array.insert(1, PDFName.of('z'));
|
|
78
|
-
expect(array.get(0)).toBe(PDFName.of('a'));
|
|
79
|
-
expect(array.get(1)).toBe(PDFName.of('z'));
|
|
80
|
-
expect(array.get(2)).toBe(PDFName.of('b'));
|
|
81
|
-
expect(array.size()).toBe(4);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it(`allows objects to be removed from specific indices`, () => {
|
|
85
|
-
const array = PDFArray.withContext(PDFContext.create());
|
|
86
|
-
array.push(PDFName.of('a'));
|
|
87
|
-
array.push(PDFName.of('b'));
|
|
88
|
-
array.push(PDFName.of('c'));
|
|
89
|
-
array.remove(1);
|
|
90
|
-
expect(array.get(0)).toBe(PDFName.of('a'));
|
|
91
|
-
expect(array.get(1)).toBe(PDFName.of('c'));
|
|
92
|
-
expect(array.size()).toBe(2);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it(`can be converted to an Array`, () => {
|
|
96
|
-
expect(pdfArray.asArray()).toEqual([
|
|
97
|
-
pdfBool,
|
|
98
|
-
pdfHexString,
|
|
99
|
-
pdfName,
|
|
100
|
-
pdfNull,
|
|
101
|
-
pdfNumber,
|
|
102
|
-
pdfString,
|
|
103
|
-
pdfSubArray,
|
|
104
|
-
pdfRef,
|
|
105
|
-
]);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it(`can be cloned`, () => {
|
|
109
|
-
const original = pdfArray;
|
|
110
|
-
const clone = original.clone();
|
|
111
|
-
expect(clone).not.toBe(original);
|
|
112
|
-
expect(clone.toString()).toBe(original.toString());
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it(`can be converted to a string`, () => {
|
|
116
|
-
expect(String(pdfArray)).toBe(
|
|
117
|
-
'[ true <ABC123> /Foo#23Bar! null -24.179 (foobar) [ true <<\n/Foo /Bar\n>> ] 21 92 R ]',
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it(`can provide its size in bytes`, () => {
|
|
122
|
-
expect(pdfArray.sizeInBytes()).toBe(84);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it(`can be serialized`, () => {
|
|
126
|
-
const buffer = new Uint8Array(88).fill(toCharCode(' '));
|
|
127
|
-
expect(pdfArray.copyBytesInto(buffer, 3)).toBe(84);
|
|
128
|
-
expect(buffer).toEqual(
|
|
129
|
-
typedArrayFor(
|
|
130
|
-
' [ true <ABC123> /Foo#23Bar! null -24.179 (foobar) [ true <<\n/Foo /Bar\n>> ] 21 92 R ] ',
|
|
131
|
-
),
|
|
132
|
-
);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { PDFBool, PrivateConstructorError } from '../../../src/core';
|
|
2
|
-
import { toCharCode, typedArrayFor } from '../../../src/utils';
|
|
3
|
-
|
|
4
|
-
describe(`PDFBool`, () => {
|
|
5
|
-
it(`cannot be publicly constructed`, () => {
|
|
6
|
-
expect(() => new (PDFBool as any)({}, true)).toThrow(
|
|
7
|
-
new PrivateConstructorError(PDFBool.name),
|
|
8
|
-
);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it(`can be converted to a boolean`, () => {
|
|
12
|
-
expect(PDFBool.True.asBoolean()).toBe(true);
|
|
13
|
-
expect(PDFBool.False.asBoolean()).toBe(false);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it(`can be cloned`, () => {
|
|
17
|
-
expect(PDFBool.True.clone()).toBe(PDFBool.True);
|
|
18
|
-
expect(PDFBool.False.clone()).toBe(PDFBool.False);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it(`can be converted to a string`, () => {
|
|
22
|
-
expect(String(PDFBool.True)).toBe('true');
|
|
23
|
-
expect(String(PDFBool.False)).toBe('false');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it(`can provide its size in bytes`, () => {
|
|
27
|
-
expect(PDFBool.True.sizeInBytes()).toBe(4);
|
|
28
|
-
expect(PDFBool.False.sizeInBytes()).toBe(5);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it(`can be serialized when true`, () => {
|
|
32
|
-
const buffer = new Uint8Array(8).fill(toCharCode(' '));
|
|
33
|
-
expect(PDFBool.True.copyBytesInto(buffer, 3)).toBe(4);
|
|
34
|
-
expect(buffer).toEqual(typedArrayFor(' true '));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it(`can be serialized when false`, () => {
|
|
38
|
-
const buffer = new Uint8Array(9).fill(toCharCode(' '));
|
|
39
|
-
expect(PDFBool.False.copyBytesInto(buffer, 1)).toBe(5);
|
|
40
|
-
expect(buffer).toEqual(typedArrayFor(' false '));
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PDFArray,
|
|
3
|
-
PDFBool,
|
|
4
|
-
PDFContext,
|
|
5
|
-
PDFDict,
|
|
6
|
-
PDFHexString,
|
|
7
|
-
PDFName,
|
|
8
|
-
PDFNull,
|
|
9
|
-
PDFNumber,
|
|
10
|
-
PDFRef,
|
|
11
|
-
PDFString,
|
|
12
|
-
PDFObject,
|
|
13
|
-
} from '../../../src/core';
|
|
14
|
-
import { toCharCode, typedArrayFor } from '../../../src/utils';
|
|
15
|
-
|
|
16
|
-
describe(`PDFDict`, () => {
|
|
17
|
-
const context = PDFContext.create();
|
|
18
|
-
|
|
19
|
-
it(`can be constructed from PDFDict.withContext(...)`, () => {
|
|
20
|
-
expect(PDFDict.withContext(context)).toBeInstanceOf(PDFDict);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const pdfDict = PDFDict.withContext(context);
|
|
24
|
-
|
|
25
|
-
const pdfBool = PDFBool.True;
|
|
26
|
-
const pdfHexString = PDFHexString.of('ABC123');
|
|
27
|
-
const pdfName = PDFName.of('Foo#Bar!');
|
|
28
|
-
const pdfNull = PDFNull;
|
|
29
|
-
const pdfNumber = PDFNumber.of(-24.179);
|
|
30
|
-
const pdfString = PDFString.of('foobar');
|
|
31
|
-
const pdfRef = PDFRef.of(21, 92);
|
|
32
|
-
|
|
33
|
-
pdfDict.set(PDFName.of('Boolean'), pdfBool);
|
|
34
|
-
pdfDict.set(PDFName.of('HexString'), pdfHexString);
|
|
35
|
-
pdfDict.set(PDFName.of('Name'), pdfName);
|
|
36
|
-
pdfDict.set(PDFName.of('Null'), pdfNull);
|
|
37
|
-
pdfDict.set(PDFName.of('Number'), pdfNumber);
|
|
38
|
-
pdfDict.set(PDFName.of('String'), pdfString);
|
|
39
|
-
pdfDict.set(PDFName.of('Ref'), pdfRef);
|
|
40
|
-
|
|
41
|
-
const pdfArray = PDFArray.withContext(context);
|
|
42
|
-
pdfArray.push(PDFBool.True);
|
|
43
|
-
pdfArray.push(PDFNull);
|
|
44
|
-
|
|
45
|
-
const pdfSubDict = PDFDict.withContext(context);
|
|
46
|
-
pdfSubDict.set(PDFName.of('Array'), pdfArray);
|
|
47
|
-
|
|
48
|
-
pdfDict.set(PDFName.of('Dictionary'), pdfSubDict);
|
|
49
|
-
|
|
50
|
-
it(`can detect if a value is present`, () => {
|
|
51
|
-
expect(pdfDict.has(PDFName.of('Boolean'))).toBe(true);
|
|
52
|
-
expect(pdfDict.has(PDFName.of('HexString'))).toBe(true);
|
|
53
|
-
expect(pdfDict.has(PDFName.of('Name'))).toBe(true);
|
|
54
|
-
expect(pdfDict.has(PDFName.of('Null'))).toBe(false);
|
|
55
|
-
expect(pdfDict.has(PDFName.of('Number'))).toBe(true);
|
|
56
|
-
expect(pdfDict.has(PDFName.of('String'))).toBe(true);
|
|
57
|
-
expect(pdfDict.has(PDFName.of('Ref'))).toBe(true);
|
|
58
|
-
expect(pdfDict.has(PDFName.of('Dictionary'))).toBe(true);
|
|
59
|
-
expect(pdfSubDict.has(PDFName.of('Array'))).toBe(true);
|
|
60
|
-
expect(pdfDict.has(PDFName.of('foo'))).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it(`retains entered objects`, () => {
|
|
64
|
-
expect(pdfDict.entries().length).toBe(8);
|
|
65
|
-
|
|
66
|
-
expect(pdfDict.get(PDFName.of('Boolean'))).toBe(pdfBool);
|
|
67
|
-
expect(pdfDict.get(PDFName.of('HexString'))).toBe(pdfHexString);
|
|
68
|
-
expect(pdfDict.get(PDFName.of('Name'))).toBe(pdfName);
|
|
69
|
-
expect(pdfDict.get(PDFName.of('Null'))).toBe(undefined);
|
|
70
|
-
expect(pdfDict.get(PDFName.of('Number'))).toBe(pdfNumber);
|
|
71
|
-
expect(pdfDict.get(PDFName.of('String'))).toBe(pdfString);
|
|
72
|
-
expect(pdfDict.get(PDFName.of('Ref'))).toBe(pdfRef);
|
|
73
|
-
expect(pdfDict.get(PDFName.of('Dictionary'))).toBe(pdfSubDict);
|
|
74
|
-
expect(pdfSubDict.get(PDFName.of('Array'))).toBe(pdfArray);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it(`can be converted to a Map`, () => {
|
|
78
|
-
expect(pdfDict.asMap()).toEqual(
|
|
79
|
-
new Map<PDFName, PDFObject>([
|
|
80
|
-
[PDFName.of('Boolean'), pdfBool],
|
|
81
|
-
[PDFName.of('HexString'), pdfHexString],
|
|
82
|
-
[PDFName.of('Name'), pdfName],
|
|
83
|
-
[PDFName.of('Null'), pdfNull],
|
|
84
|
-
[PDFName.of('Number'), pdfNumber],
|
|
85
|
-
[PDFName.of('String'), pdfString],
|
|
86
|
-
[PDFName.of('Ref'), pdfRef],
|
|
87
|
-
[PDFName.of('Dictionary'), pdfSubDict],
|
|
88
|
-
]),
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it(`can be cloned`, () => {
|
|
93
|
-
const original = pdfDict;
|
|
94
|
-
const clone = original.clone();
|
|
95
|
-
expect(clone).not.toBe(original);
|
|
96
|
-
expect(clone.toString()).toBe(original.toString());
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it(`can be converted to a string`, () => {
|
|
100
|
-
expect(String(pdfDict)).toBe(
|
|
101
|
-
`<<
|
|
102
|
-
/Boolean true
|
|
103
|
-
/HexString <ABC123>
|
|
104
|
-
/Name /Foo#23Bar!
|
|
105
|
-
/Null null
|
|
106
|
-
/Number -24.179
|
|
107
|
-
/String (foobar)
|
|
108
|
-
/Ref 21 92 R
|
|
109
|
-
/Dictionary <<
|
|
110
|
-
/Array [ true null ]
|
|
111
|
-
>>
|
|
112
|
-
>>`,
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it(`can provide its size in bytes`, () => {
|
|
117
|
-
expect(pdfDict.sizeInBytes()).toBe(153);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it(`can be serialized`, () => {
|
|
121
|
-
const buffer = new Uint8Array(157).fill(toCharCode(' '));
|
|
122
|
-
expect(pdfDict.copyBytesInto(buffer, 3)).toBe(153);
|
|
123
|
-
expect(buffer).toEqual(
|
|
124
|
-
typedArrayFor(
|
|
125
|
-
` <<
|
|
126
|
-
/Boolean true
|
|
127
|
-
/HexString <ABC123>
|
|
128
|
-
/Name /Foo#23Bar!
|
|
129
|
-
/Null null
|
|
130
|
-
/Number -24.179
|
|
131
|
-
/String (foobar)
|
|
132
|
-
/Ref 21 92 R
|
|
133
|
-
/Dictionary <<
|
|
134
|
-
/Array [ true null ]
|
|
135
|
-
>>
|
|
136
|
-
>> `,
|
|
137
|
-
),
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it(`returns "undefined" if the underlying value is "PDFNull"`, () => {
|
|
142
|
-
const dict = context.obj({ foo: null });
|
|
143
|
-
dict.set(PDFName.of('Bar'), PDFNull);
|
|
144
|
-
context.assign(PDFRef.of(21), PDFNull);
|
|
145
|
-
dict.set(PDFName.of('qux'), PDFRef.of(21));
|
|
146
|
-
|
|
147
|
-
expect(dict.get(PDFName.of('foo'))).toBe(undefined);
|
|
148
|
-
expect(dict.get(PDFName.of('Bar'))).toBe(undefined);
|
|
149
|
-
expect(dict.get(PDFName.of('qux'))).toBe(PDFRef.of(21));
|
|
150
|
-
|
|
151
|
-
expect(dict.lookup(PDFName.of('foo'))).toBe(undefined);
|
|
152
|
-
expect(dict.lookup(PDFName.of('Bar'))).toBe(undefined);
|
|
153
|
-
expect(dict.lookup(PDFName.of('qux'))).toBe(undefined);
|
|
154
|
-
|
|
155
|
-
expect(dict.lookup(PDFName.of('foo'), PDFNull)).toBe(PDFNull);
|
|
156
|
-
expect(dict.lookup(PDFName.of('Bar'), PDFNull)).toBe(PDFNull);
|
|
157
|
-
expect(dict.lookup(PDFName.of('qux'), PDFNull)).toBe(PDFNull);
|
|
158
|
-
|
|
159
|
-
expect(dict.lookupMaybe(PDFName.of('foo'), PDFNull)).toBe(PDFNull);
|
|
160
|
-
expect(dict.lookupMaybe(PDFName.of('Bar'), PDFNull)).toBe(PDFNull);
|
|
161
|
-
expect(dict.lookupMaybe(PDFName.of('qux'), PDFNull)).toBe(PDFNull);
|
|
162
|
-
|
|
163
|
-
expect(dict.lookupMaybe(PDFName.of('foo'), PDFDict)).toBe(undefined);
|
|
164
|
-
expect(dict.lookupMaybe(PDFName.of('Bar'), PDFDict)).toBe(undefined);
|
|
165
|
-
expect(dict.lookupMaybe(PDFName.of('qux'), PDFDict)).toBe(undefined);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// https://github.com/Hopding/pdf-lib/issues/1075
|
|
169
|
-
it(`can generate new keys that don't conflict with existing ones`, () => {
|
|
170
|
-
const anotherContext = PDFContext.create();
|
|
171
|
-
const anotherDict = anotherContext.obj({});
|
|
172
|
-
const anotherKey = anotherDict.uniqueKey();
|
|
173
|
-
|
|
174
|
-
const dict = context.obj({});
|
|
175
|
-
expect(dict.keys().length).toBe(0);
|
|
176
|
-
|
|
177
|
-
dict.set(anotherKey, context.obj('boing'));
|
|
178
|
-
expect(dict.keys().length).toBe(1);
|
|
179
|
-
|
|
180
|
-
const key1 = dict.uniqueKey();
|
|
181
|
-
dict.set(key1, context.obj('beep'));
|
|
182
|
-
expect(dict.keys().length).toBe(2);
|
|
183
|
-
|
|
184
|
-
const key2 = dict.uniqueKey();
|
|
185
|
-
dict.set(key2, context.obj('boop'));
|
|
186
|
-
expect(dict.keys().length).toBe(3);
|
|
187
|
-
|
|
188
|
-
const key3 = dict.uniqueKey();
|
|
189
|
-
dict.set(key3, context.obj('baap'));
|
|
190
|
-
expect(dict.keys().length).toBe(4);
|
|
191
|
-
|
|
192
|
-
expect(new Set(dict.keys()).size).toBe(4);
|
|
193
|
-
expect(dict.keys()).toEqual([anotherKey, key1, key2, key3]);
|
|
194
|
-
});
|
|
195
|
-
});
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { PDFHexString } from '../../../src/core';
|
|
2
|
-
import { toCharCode, typedArrayFor } from '../../../src/utils';
|
|
3
|
-
|
|
4
|
-
describe(`PDFHexString`, () => {
|
|
5
|
-
it(`can be constructed from PDFHexString.of(...)`, () => {
|
|
6
|
-
expect(PDFHexString.of('4E6F762073686D6F7A2')).toBeInstanceOf(PDFHexString);
|
|
7
|
-
expect(PDFHexString.of('901FA3')).toBeInstanceOf(PDFHexString);
|
|
8
|
-
expect(PDFHexString.of('901FA')).toBeInstanceOf(PDFHexString);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it(`can be constructed from a string of text (using UTF-16BE encoding)`, () => {
|
|
12
|
-
expect(String(PDFHexString.fromText(''))).toBe('<FEFF>');
|
|
13
|
-
expect(String(PDFHexString.fromText('ä☺𠜎️☁️💩'))).toBe(
|
|
14
|
-
'<FEFF00E4263AD841DF0EFE0F2601FE0FD83DDCA9>',
|
|
15
|
-
);
|
|
16
|
-
expect(String(PDFHexString.fromText('stuff 💩 and 🎂things'))).toBe(
|
|
17
|
-
'<FEFF007300740075006600660020D83DDCA900200061006E00640020D83CDF82007400680069006E00670073>',
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe(`converting to bytes`, () => {
|
|
22
|
-
it(`can handle an even number of hex digits`, () => {
|
|
23
|
-
const hex = 'FEFF0045006700670020D83CDF73';
|
|
24
|
-
|
|
25
|
-
// prettier-ignore
|
|
26
|
-
expect(PDFHexString.of(hex).asBytes()).toEqual(Uint8Array.of(
|
|
27
|
-
0xFE, 0xFF,
|
|
28
|
-
0x00, 0x45,
|
|
29
|
-
0x00, 0x67,
|
|
30
|
-
0x00, 0x67,
|
|
31
|
-
0x00, 0x20,
|
|
32
|
-
0xD8, 0x3C,
|
|
33
|
-
0xDF, 0x73,
|
|
34
|
-
));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it(`can handle an odd number of hex digits`, () => {
|
|
38
|
-
const hex = '6145627300623';
|
|
39
|
-
|
|
40
|
-
// prettier-ignore
|
|
41
|
-
expect(PDFHexString.of(hex).asBytes()).toEqual(Uint8Array.of(
|
|
42
|
-
0x61, 0x45,
|
|
43
|
-
0x62, 0x73,
|
|
44
|
-
0x00, 0x62,
|
|
45
|
-
0x30,
|
|
46
|
-
));
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe(`decoding to string`, () => {
|
|
51
|
-
it(`can interpret UTF-16BE strings`, () => {
|
|
52
|
-
const hex = 'FEFF0045006700670020D83CDF73';
|
|
53
|
-
expect(PDFHexString.of(hex).decodeText()).toBe('Egg 🍳');
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it(`can interpret UTF-16LE strings`, () => {
|
|
57
|
-
const hex = 'FFFE45006700670020003CD873DF';
|
|
58
|
-
expect(PDFHexString.of(hex).decodeText()).toBe('Egg 🍳');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it(`can interpret PDFDocEncoded strings`, () => {
|
|
62
|
-
const hex = '61456273006236';
|
|
63
|
-
expect(PDFHexString.of(hex).decodeText()).toBe('aEbs\0b6');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe(`decoding to date`, () => {
|
|
68
|
-
it(`can interpret date strings of the form D:YYYYMMDDHHmmSSOHH'mm`, () => {
|
|
69
|
-
expect(
|
|
70
|
-
PDFHexString.fromText(`D:20200321165011+01'01`).decodeDate(),
|
|
71
|
-
).toStrictEqual(new Date('2020-03-21T15:49:11Z'));
|
|
72
|
-
expect(
|
|
73
|
-
PDFHexString.fromText(`D:20200321165011-01'01`).decodeDate(),
|
|
74
|
-
).toStrictEqual(new Date('2020-03-21T17:51:11Z'));
|
|
75
|
-
expect(
|
|
76
|
-
PDFHexString.fromText(`D:20200321165011Z00'00`).decodeDate(),
|
|
77
|
-
).toStrictEqual(new Date('2020-03-21T16:50:11Z'));
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it(`can interpret date strings of the form D:YYYYMMDDHHmmSSOHH`, () => {
|
|
81
|
-
expect(
|
|
82
|
-
PDFHexString.fromText('D:20200321165011+01').decodeDate(),
|
|
83
|
-
).toStrictEqual(new Date('2020-03-21T15:50:11Z'));
|
|
84
|
-
expect(
|
|
85
|
-
PDFHexString.fromText('D:20200321165011-01').decodeDate(),
|
|
86
|
-
).toStrictEqual(new Date('2020-03-21T17:50:11Z'));
|
|
87
|
-
expect(
|
|
88
|
-
PDFHexString.fromText('D:20200321165011Z00').decodeDate(),
|
|
89
|
-
).toStrictEqual(new Date('2020-03-21T16:50:11Z'));
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it(`can interpret date strings of the form D:YYYYMMDDHHmmSSO`, () => {
|
|
93
|
-
expect(
|
|
94
|
-
PDFHexString.fromText('D:20200321165011Z').decodeDate(),
|
|
95
|
-
).toStrictEqual(new Date('2020-03-21T16:50:11Z'));
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it(`can interpret date strings of the form D:YYYYMMDDHHmmSS`, () => {
|
|
99
|
-
expect(
|
|
100
|
-
PDFHexString.fromText('D:20200321165011').decodeDate(),
|
|
101
|
-
).toStrictEqual(new Date('2020-03-21T16:50:11Z'));
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it(`can interpret date strings of the form D:YYYYMMDDHHmm`, () => {
|
|
105
|
-
expect(
|
|
106
|
-
PDFHexString.fromText('D:202003211650').decodeDate(),
|
|
107
|
-
).toStrictEqual(new Date('2020-03-21T16:50:00Z'));
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it(`can interpret date strings of the form D:YYYYMMDDHH`, () => {
|
|
111
|
-
expect(PDFHexString.fromText('D:2020032116').decodeDate()).toStrictEqual(
|
|
112
|
-
new Date('2020-03-21T16:00:00Z'),
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it(`can interpret date strings of the form D:YYYYMMDD`, () => {
|
|
117
|
-
expect(PDFHexString.fromText('D:20200321').decodeDate()).toStrictEqual(
|
|
118
|
-
new Date('2020-03-21T00:00:00Z'),
|
|
119
|
-
);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it(`can interpret date strings of the form D:YYYYMM`, () => {
|
|
123
|
-
expect(PDFHexString.fromText('D:202003').decodeDate()).toStrictEqual(
|
|
124
|
-
new Date('2020-03-01T00:00:00Z'),
|
|
125
|
-
);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it(`can interpret date strings of the form D:YYYY`, () => {
|
|
129
|
-
expect(PDFHexString.fromText('D:2020').decodeDate()).toStrictEqual(
|
|
130
|
-
new Date('2020-01-01T00:00:00Z'),
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it(`can be converted to a string`, () => {
|
|
136
|
-
expect(PDFHexString.of('901FA').asString()).toBe('901FA');
|
|
137
|
-
expect(PDFHexString.fromText('stuff 💩 and 🎂things').asString()).toBe(
|
|
138
|
-
'FEFF007300740075006600660020D83DDCA900200061006E00640020D83CDF82007400680069006E00670073',
|
|
139
|
-
);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it(`can be cloned`, () => {
|
|
143
|
-
const original = PDFHexString.of('901FA');
|
|
144
|
-
const clone = original.clone();
|
|
145
|
-
expect(clone).not.toBe(original);
|
|
146
|
-
expect(clone.toString()).toBe(original.toString());
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it(`can be converted to a string`, () => {
|
|
150
|
-
expect(String(PDFHexString.of('4E6F762073686D6F7A2'))).toBe(
|
|
151
|
-
'<4E6F762073686D6F7A2>',
|
|
152
|
-
);
|
|
153
|
-
expect(String(PDFHexString.of('901FA3'))).toBe('<901FA3>');
|
|
154
|
-
expect(String(PDFHexString.of('901FA'))).toBe('<901FA>');
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it(`can provide its size in bytes`, () => {
|
|
158
|
-
expect(PDFHexString.of('4E6F762073686D6F7A2').sizeInBytes()).toBe(21);
|
|
159
|
-
expect(PDFHexString.of('901FA3').sizeInBytes()).toBe(8);
|
|
160
|
-
expect(PDFHexString.of('901FA').sizeInBytes()).toBe(7);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it(`can be serialized`, () => {
|
|
164
|
-
const buffer = new Uint8Array(11).fill(toCharCode(' '));
|
|
165
|
-
expect(PDFHexString.of('901FA').copyBytesInto(buffer, 3)).toBe(7);
|
|
166
|
-
expect(buffer).toEqual(typedArrayFor(' <901FA> '));
|
|
167
|
-
});
|
|
168
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { PDFInvalidObject } from '../../../src/core';
|
|
2
|
-
|
|
3
|
-
describe(`PDFInvalidObject`, () => {
|
|
4
|
-
const data = new Uint8Array([12, 39, 92, 38, 38, 28, 49]);
|
|
5
|
-
|
|
6
|
-
it(`can be constructed from PDFInvalidObject.of(...)`, () => {
|
|
7
|
-
expect(PDFInvalidObject.of(data)).toBeInstanceOf(PDFInvalidObject);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it(`can be cloned`, () => {
|
|
11
|
-
const original = PDFInvalidObject.of(data);
|
|
12
|
-
const clone = original.clone();
|
|
13
|
-
expect(clone).not.toBe(original);
|
|
14
|
-
expect(clone.toString()).toEqual(original.toString());
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it(`can be converted to a string`, () => {
|
|
18
|
-
expect(String(PDFInvalidObject.of(data))).toBe('PDFInvalidObject(7 bytes)');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it(`can provide its size in bytes`, () => {
|
|
22
|
-
expect(PDFInvalidObject.of(data).sizeInBytes()).toBe(7);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it(`can be serialized`, () => {
|
|
26
|
-
const buffer = new Uint8Array(11).fill(0);
|
|
27
|
-
expect(PDFInvalidObject.of(data).copyBytesInto(buffer, 3)).toBe(7);
|
|
28
|
-
expect(buffer).toEqual(
|
|
29
|
-
new Uint8Array([0, 0, 0, 12, 39, 92, 38, 38, 28, 49, 0]),
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { PDFName, PrivateConstructorError } from '../../../src/core';
|
|
2
|
-
import { toCharCode, typedArrayFor } from '../../../src/utils';
|
|
3
|
-
|
|
4
|
-
describe(`PDFName`, () => {
|
|
5
|
-
it(`can be constructed from PDFName.of(...)`, () => {
|
|
6
|
-
expect(PDFName.of('foobar')).toBeInstanceOf(PDFName);
|
|
7
|
-
expect(PDFName.of('A;Name_With-***Characters?')).toBeInstanceOf(PDFName);
|
|
8
|
-
expect(PDFName.of('paired#28#29parentheses')).toBeInstanceOf(PDFName);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it(`cannot be publicly constructed`, () => {
|
|
12
|
-
expect(() => new (PDFName as any)({}, 'stuff')).toThrow(
|
|
13
|
-
new PrivateConstructorError(PDFName.name),
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it(`returns the same instance when given the same value`, () => {
|
|
18
|
-
expect(PDFName.of('foobar')).toBe(PDFName.of('foobar'));
|
|
19
|
-
expect(PDFName.of('A;Name_With-***Characters?')).toBe(
|
|
20
|
-
PDFName.of('A;Name_With-***Characters?'),
|
|
21
|
-
);
|
|
22
|
-
expect(PDFName.of('paired#28#29parentheses')).toBe(
|
|
23
|
-
PDFName.of('paired#28#29parentheses'),
|
|
24
|
-
);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it(`decodes hex codes in the values`, () => {
|
|
28
|
-
expect(PDFName.of('Lime#20Green')).toBe(PDFName.of('Lime Green'));
|
|
29
|
-
expect(PDFName.of('paired#28#29parentheses')).toBe(
|
|
30
|
-
PDFName.of('paired()parentheses'),
|
|
31
|
-
);
|
|
32
|
-
expect(PDFName.of('The_Key_of_F#23_Minor')).toBe(
|
|
33
|
-
PDFName.of('The_Key_of_F#_Minor'),
|
|
34
|
-
);
|
|
35
|
-
expect(PDFName.of('A#42')).toBe(PDFName.of('AB'));
|
|
36
|
-
expect(PDFName.of('Identity#2DH')).toBe(PDFName.of('Identity-H'));
|
|
37
|
-
|
|
38
|
-
expect(PDFName.of('#40')).toBe(PDFName.of('@'));
|
|
39
|
-
expect(PDFName.of('#41')).toBe(PDFName.of('A'));
|
|
40
|
-
expect(PDFName.of('#42')).toBe(PDFName.of('B'));
|
|
41
|
-
expect(PDFName.of('#43')).toBe(PDFName.of('C'));
|
|
42
|
-
expect(PDFName.of('#44')).toBe(PDFName.of('D'));
|
|
43
|
-
expect(PDFName.of('#45')).toBe(PDFName.of('E'));
|
|
44
|
-
expect(PDFName.of('#46')).toBe(PDFName.of('F'));
|
|
45
|
-
expect(PDFName.of('#47')).toBe(PDFName.of('G'));
|
|
46
|
-
expect(PDFName.of('#48')).toBe(PDFName.of('H'));
|
|
47
|
-
expect(PDFName.of('#49')).toBe(PDFName.of('I'));
|
|
48
|
-
expect(PDFName.of('#4A')).toBe(PDFName.of('J'));
|
|
49
|
-
expect(PDFName.of('#4B')).toBe(PDFName.of('K'));
|
|
50
|
-
expect(PDFName.of('#4C')).toBe(PDFName.of('L'));
|
|
51
|
-
expect(PDFName.of('#4D')).toBe(PDFName.of('M'));
|
|
52
|
-
expect(PDFName.of('#4E')).toBe(PDFName.of('N'));
|
|
53
|
-
expect(PDFName.of('#4F')).toBe(PDFName.of('O'));
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it(`encodes hashes, whitespace, and delimiters when serialized`, () => {
|
|
57
|
-
expect(PDFName.of('Foo#').toString()).toBe('/Foo#23');
|
|
58
|
-
|
|
59
|
-
// Note that the \0 shouldn't ever be written into a name,
|
|
60
|
-
// but we'll support it for parsing flexibility sake
|
|
61
|
-
expect(PDFName.of('Foo\0').toString()).toBe('/Foo#00');
|
|
62
|
-
expect(PDFName.of('Foo\t').toString()).toBe('/Foo#09');
|
|
63
|
-
expect(PDFName.of('Foo\n').toString()).toBe('/Foo#0A');
|
|
64
|
-
expect(PDFName.of('Foo\f').toString()).toBe('/Foo#0C');
|
|
65
|
-
expect(PDFName.of('Foo\r').toString()).toBe('/Foo#0D');
|
|
66
|
-
expect(PDFName.of('Foo ').toString()).toBe('/Foo#20');
|
|
67
|
-
|
|
68
|
-
expect(PDFName.of('Foo(').toString()).toBe('/Foo#28');
|
|
69
|
-
expect(PDFName.of('Foo)').toString()).toBe('/Foo#29');
|
|
70
|
-
expect(PDFName.of('Foo<').toString()).toBe('/Foo#3C');
|
|
71
|
-
expect(PDFName.of('Foo>').toString()).toBe('/Foo#3E');
|
|
72
|
-
expect(PDFName.of('Foo[').toString()).toBe('/Foo#5B');
|
|
73
|
-
expect(PDFName.of('Foo]').toString()).toBe('/Foo#5D');
|
|
74
|
-
expect(PDFName.of('Foo{').toString()).toBe('/Foo#7B');
|
|
75
|
-
expect(PDFName.of('Foo}').toString()).toBe('/Foo#7D');
|
|
76
|
-
expect(PDFName.of('Foo/').toString()).toBe('/Foo#2F');
|
|
77
|
-
expect(PDFName.of('Foo%').toString()).toBe('/Foo#25');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it(`can be cloned`, () => {
|
|
81
|
-
expect(PDFName.of('foobar').clone()).toBe(PDFName.of('foobar'));
|
|
82
|
-
expect(PDFName.of('Lime#20Green').clone()).toBe(PDFName.of('Lime Green'));
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it(`can be converted to a string`, () => {
|
|
86
|
-
expect(String(PDFName.of('foobar'))).toBe('/foobar');
|
|
87
|
-
expect(String(PDFName.of('Lime Green'))).toBe('/Lime#20Green');
|
|
88
|
-
expect(String(PDFName.of('\0\t\n\f\r '))).toBe('/#00#09#0A#0C#0D#20');
|
|
89
|
-
expect(String(PDFName.of('Foo#Bar'))).toBe('/Foo#23Bar');
|
|
90
|
-
expect(String(PDFName.of('paired()parentheses'))).toBe(
|
|
91
|
-
'/paired#28#29parentheses',
|
|
92
|
-
);
|
|
93
|
-
expect(String(PDFName.of('The_Key_of_F#23_Minor'))).toBe(
|
|
94
|
-
'/The_Key_of_F#23_Minor',
|
|
95
|
-
);
|
|
96
|
-
expect(String(PDFName.of('A#42'))).toBe('/AB');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it(`can provide its size in bytes`, () => {
|
|
100
|
-
expect(PDFName.of('foobar').sizeInBytes()).toBe(7);
|
|
101
|
-
expect(PDFName.of('Lime Green').sizeInBytes()).toBe(13);
|
|
102
|
-
expect(PDFName.of('\0\t\n\f\r ').sizeInBytes()).toBe(19);
|
|
103
|
-
expect(PDFName.of('Foo#Bar').sizeInBytes()).toBe(10);
|
|
104
|
-
expect(PDFName.of('paired()parentheses').sizeInBytes()).toBe(24);
|
|
105
|
-
expect(PDFName.of('The_Key_of_F#23_Minor').sizeInBytes()).toBe(22);
|
|
106
|
-
expect(PDFName.of('A#42').sizeInBytes()).toBe(3);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it(`can be serialized`, () => {
|
|
110
|
-
const buffer1 = new Uint8Array(23).fill(toCharCode(' '));
|
|
111
|
-
expect(PDFName.of('\0\t\n\f\r ').copyBytesInto(buffer1, 3)).toBe(19);
|
|
112
|
-
expect(buffer1).toEqual(typedArrayFor(' /#00#09#0A#0C#0D#20 '));
|
|
113
|
-
|
|
114
|
-
const buffer2 = new Uint8Array(17).fill(toCharCode(' '));
|
|
115
|
-
expect(PDFName.of('Lime Green').copyBytesInto(buffer2, 1)).toBe(13);
|
|
116
|
-
expect(buffer2).toEqual(typedArrayFor(' /Lime#20Green '));
|
|
117
|
-
|
|
118
|
-
const buffer3 = new Uint8Array(7).fill(toCharCode(' '));
|
|
119
|
-
expect(PDFName.of('A#42').copyBytesInto(buffer3, 4)).toBe(3);
|
|
120
|
-
expect(buffer3).toEqual(typedArrayFor(' /AB'));
|
|
121
|
-
});
|
|
122
|
-
});
|