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

[Question] Is it possible to make placeholder-pdfkit works with Buffer #256

Open
zentetsukenz opened this issue May 31, 2024 · 2 comments
Open

Comments

@zentetsukenz
Copy link

Objective
I would like to migrate from using the placeholder-plain to placeholder-pdfkit.

The reason is that the placeholder-plain still depends on the older version of placeholder-pdfkit010 which unfortunately, rely on older version of "crypto-js": "^3.1.9-1".

Migrating from the plain to the pdfkit would allow my application to rely on the newer version of the crypto-js.

What I've tried
I've tried replicate how the placeholder-plain make use of the placeholder-pdfkit010 (by creating a pdfKitMock object), but with the placeholder-pdfkit instead. Unfortunately, it doesn't work.

My guess is that PDFkit 0.11 works differently from the 0.10. Hence, simply copy the way how plain version works won't make the 0.11 work magically.

So
Do you have any suggestion or recommendation on how to make this works? I'm happy to open a PR but would like to hear from you first (any guidance would be very appreciated 🙏 ).

The only alternative way I can think of
Simply change placeholder-plain dependency to placeholder-pdfkit but, yeah, I think I have to deal with PDFKit 0.10 -> PDFKit 0.11 breaking changes.

@vbuch
Copy link
Owner

vbuch commented Jun 2, 2024

Hi.
I'd always imagined that it should be possible to upgrade from pdfkit 10 to newer versions. But to provide the correct mocking object would require understanding how 11+ works internally really. That's a bad chain of dependencies really. I think what we are using from PDFKit is generally the understanding of references and object encoding...

@zentetsukenz
Copy link
Author

I think I found another alternative, simply override pdfkit peer dependency just work.

package.json

  "overrides": {
    "@signpdf/placeholder-plain": {
      "pdfkit": "^0.15.0"
    }
  }

And to anyone happen to read this decide to use this method, probably a good idea to test your use cases and lock a pdfkit version.

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