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

AddPage throw an exception #607

Closed
SecureExchanges opened this issue Sep 17, 2020 · 4 comments
Closed

AddPage throw an exception #607

SecureExchanges opened this issue Sep 17, 2020 · 4 comments

Comments

@SecureExchanges
Copy link

SecureExchanges commented Sep 17, 2020

Hello,

We don't really know why (we do not investiguated) but with some specific document we are not able to addPage.

The error occur in that method

 PDFPageTree.prototype.ascend = function (visitor) {
      visitor(this);
      var Parent = this.Parent();
      if (Parent)
        Parent.ascend(visitor);
    };

We fixed the issue by adding the validation on the ascend function. The object exist, but the ascend do not.

 PDFPageTree.prototype.ascend = function (visitor) {
      visitor(this);
      var Parent = this.Parent();
      if (Parent&&Parent.ascend)
        Parent.ascend(visitor);
    };
@Hopding
Copy link
Owner

Hopding commented Sep 17, 2020

Hello @cboivin80! Thanks for reporting this. Are you able to share a document that can be used to reproduce the issue?

@SecureExchanges
Copy link
Author

Ok there is the file.

I remove all the pages and leave only one.

bugged-document.pdf

@Hopding
Copy link
Owner

Hopding commented Sep 18, 2020

@cboivin80 Release candidate 1.11.2-rc1 is now published. It contains a fix for this issue (see #608). Please let me know if it solves the problem for your private document!

You can install this new version with npm:

npm install pdf-lib@1.11.2-rc1

It's also available on unpkg:

As well as jsDelivr:

@Hopding Hopding closed this as completed Sep 18, 2020
@SecureExchanges
Copy link
Author

Yes it's fix. Thank you so much.

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