TypeError: Cannot read property 'clone' of undefined
See original GitHub issueHi,
When trying to copy a specific PDF, i have the error : TypeError: Cannot read property 'clone' of undefined
Here is a not working example : https://runkit.com/gautiert/5d81e279596dfc0015e16a7c
Probably related to #186
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Cannot read property 'clone' of undefined · Issue #539 - GitHub
This error appear if Owl container has only 1 child. If there are to Items then it works perfectly. I use this for...
Read more >jQuery Owl Carousel: Cannot read property 'clone' of undefined
I am running a WordPress site. My error is below. Uncaught TypeError: Cannot read properties of undefined (reading 'clone ...
Read more >[SOLVED] Cannot read properties of undefined (reading 'clone')
I am trying to clone a platform but it says that my properties are undefined. I already checked if I accidentally missed putting...
Read more >Cannot read property 'clone' of null when inserting language
Uncaught TypeError: Cannot read property 'clone' of null when inserting language. Closed, ResolvedPublic1 Estimated Story Points. Actions.
Read more >“Uncaught TypeError: Cannot read property 'clone ... - iTecNote
For some reason I'm getting ""Uncaught TypeError: Cannot read property 'clone' of undefined" when I'm trying to update the calendar with a recent...
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 Free
Top 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
I was able to fix the problem in #200. It will go out in the next pdf-lib release.
Incase, you’re interested, the problem was due to a missing newline. The PDF states that:
This seems pretty clear cut. But it becomes ambiguous when you start dealing with incremental update sections (the file you shared here has one of these):
But it doesn’t really state whether the previous %%EOF marker should be followed by a newline before the update section’s content begins. All examples in the spec do have a newline. And every other updated PDF I’ve come across does as well.
However, the PDF you shared here does not follow this convention:
Notice line
286
. That’s what caused the issue.pdf-lib
’s parser was implicitly expecting a newline after the %%EOF. And when it didn’t find one, that caused it to enter error recovery mode and skip object 28.Gotta love the PDF spec’s ambiguity and lack of clarity 🙄. Anyhow, it’s fixed now 👍
Thanks a lot @Hopding !! Bravo for this awesome lib ! 👏