Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_this.catalog.Pages.traverse is not a function #75

Closed
minhnhatspk opened this issue Feb 20, 2019 · 4 comments
Closed

_this.catalog.Pages.traverse is not a function #75

minhnhatspk opened this issue Feb 20, 2019 · 4 comments

Comments

@minhnhatspk
Copy link

minhnhatspk commented Feb 20, 2019

As the title, I got that error when attaching some text on my pdf file.
here is full error logs

Found Linearization param dict and cross reference index, but no associated trailer.
/Users/minhnhat/Documents/MN/test/pdf-lib/examples/document_modification/node/node_modules/pdf-lib/lib/core/pdf-document/PDFDocument.js:48
            _this.catalog.Pages.traverse(function (kid) {
                                ^

TypeError: _this.catalog.Pages.traverse is not a function
    at PDFDocument.getPages (/Users/minhnhat/Documents/MN/test/pdf-lib/examples/document_modification/node/node_modules/pdf-lib/lib/core/pdf-document/PDFDocument.js:48:33)
    at Object.<anonymous> (/Users/minhnhat/Documents/MN/test/pdf-lib/examples/document_modification/node/index.js:49:22)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

Could you guys help me find the problem?

@Hopding
Copy link
Owner

Hopding commented Feb 24, 2019

@minhnhatspk I found the bug causing this issue and fixed it in #76.

I just cut prerelease 0.6.1-rc3 with the fix.

You can install this prerelease with npm:

npm install pdf-lib@0.6.1-rc3

It's also available on unpkg:

Please try it out and let me know if it works for you!

P.S. It looks like you are using the document_modification example. You'll need to update it's package.json to use this prerelease. Once I cut this as an official release, I'll update the example's package.json as well.

@Hopding
Copy link
Owner

Hopding commented Feb 24, 2019

@minhnhatspk I'd like to add the asample.pdf you shared to this repo so I can write an integration test for this bug fix. Do you mind if I do that? Does it have any private info in it?

@minhnhatspk
Copy link
Author

@minhnhatspk I'd like to add the asample.pdf you shared to this repo so I can write an integration test for this bug fix. Do you mind if I do that? Does it have any private info in it?

Yes, you can use it.
Thanks for you help.

@Hopding
Copy link
Owner

Hopding commented Feb 24, 2019

Great, thanks!

@Hopding Hopding closed this as completed Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants