SVG: TypeError: bytes.subarray is not a function
See original GitHub issueThis pdf: page-7.pdf
Command line:
git clone https://github.com/mozilla/pdf.js.git
npm install
node_modules/.bin/gulp generic-legacy
# examples/node/pdf2svg.js:
# const pdfjsLib = require("../../build/generic-legacy/build/pdf.js");
node examples/node/pdf2svg.js /tmp/page-7.pdf
Console:
# Document Loaded
Number of Pages: 1
# Page 1
Size: 612x792
Warning: Unimplemented graphic state operator SMask
Warning: Unimplemented graphic state operator BM
Warning: Unimplemented operator beginMarkedContentProps
Warning: Unimplemented operator endMarkedContent
Warning: Unimplemented operator beginMarkedContentProps
Warning: Unimplemented operator endMarkedContent
Warning: Unimplemented graphic state operator SMask
Warning: Unimplemented graphic state operator BM
Warning: Unimplemented graphic state operator SMask
Warning: Unimplemented graphic state operator BM
Warning: Unimplemented operator beginMarkedContentProps
Warning: Unimplemented operator endMarkedContent
Warning: Unimplemented operator beginMarkedContentProps
Warning: Unimplemented operator endMarkedContent
Warning: Unimplemented operator beginMarkedContentProps
Warning: Unimplemented operator endMarkedContent
Warning: Unimplemented graphic state operator SMask
Warning: Unimplemented graphic state operator BM
Error: TypeError: bytes.subarray is not a function
# End of Document
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11
Top Results From Across the Web
TypeError: SVG is not a function
import SVG from "@svgdotjs/svg.js/src/svg" //v3.0 let draw = SVG().addTo('#drawing').viewbox(0, 0, 300, 140) let rect = draw.rect(100, ...
Read more >https://unpkg.com/@syncfusion/ej2-js-es5@18.3.52/s...
SVG - Renders the bar-code objects as SVG elements * * Canvas - Renders the ... Object): HTMLElement; export function getChildNode(node: SVGElement): ...
Read more >Typed Arrays and ArrayBuffers / Jules Blom
buffer is a binary buffer that is 32-bytes long (256-bits), ... at any byte offset inside an ArrayBuffer. ... TypeError: uint8.splice is not...
Read more >PDF.js - Source code
This script should not be not be installed directly. It is a library for other scripts to include ... 'function') throw TypeError(it +...
Read more >Mozilla Firefox Release Notes
794959, Use the right cast in GetAs* functions of union types in new DOM bindings ... 786894, SVG in an active GFX layer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Assuming that this is indeed a regression, since it apparently worked before, then it’s not too difficult to imagine what could have broken this and thus also how it could be “fixed”.
However, given first of all that this code isn’t being used in the Firefox PDF Viewer and secondly that the SVG back-end is documented as being unsupported, I don’t think I can justify spending my spare-time working on this issue (since I’m not getting paid to hack on the PDF.js library).
Following up on https://github.com/mozilla/pdf.js/issues/14952#issuecomment-1152397525: If those affected by this bug are willing to compensate me for my time/knowledge, I could (pretty easily) provide a patch for this.
Please also note that since this issue was opened the SVG back-end is no longer just unmaintained/unsupported, but it’s now also been officially deprecated; see https://github.com/mozilla/pdf.js/blob/7b24931f673d68803d9dac4567ba0462ec89a835/src/display/svg.js#L468-L472
We’re pretty close to the next major PDF.js release (from
3
-branch) and after that the SVG back-end will in all likelihood receive no additional work/fixes.