Skip to content

Invalid String Length When Saving PDF #1724

Closed
@mackersD

Description

@mackersD

Thank you for submitting an issue to jsPDF. Please read carefully.

Are you using the latest version of jsPDF?
Yes (1.3.5)

Have you tried using jspdf.debug.js?
Yes

Steps to reproduce

  1. Add images to a jsPDF object that would generate a file string at around 384859244 characters. (~ 130 pages with full page canvas images generated via html2canvas)
  2. Save File.
  3. Observe Array.join error due to string being too long. (jspdf.debug.js; line 1051)

What I saw
The save function silently fails, and a console log error displays with an Invalid string length error:

index.js:2177 Error in function Array.join (native): Invalid string length RangeError: Invalid string length
    at Array.join (native)
    at buildDocument (jspdf.debug.js:1051)
    at getArrayBuffer (jspdf.debug.js:1073)
    at getBlob (jspdf.debug.js:1083)
    at Object.<anonymous> (jspdf.debug.js:1112)
    at Object.__safeCallWrapper [as output] (jspdf.debug.js:621)
    at Object.API.save (jspdf.debug.js:2191)

What I expected
I expected the pdf file to save.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions