-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
PDFKit 0.11 support #115
PDFKit 0.11 support #115
Conversation
Pull Request Test Coverage Report for Build 353
💛 - Coveralls |
2a91da1
to
788223a
Compare
I'm marking this as draft as this isn't creating the signatures quite right - from what I can see the AcroForm isn't being added to the PDF with the Good PDF (before this work):
Bad PDF (with this PR):
Other issues:
|
e76e2fd
to
73be455
Compare
@vbuch this is working now and green. It's not making quite the same use of the form APIs provided and has to make some modifications to the AcroForm that is generated, but it does mean that PDFs are successfully signed by the library when using pdfkit 0.11 |
@dhensby I haven't had a good look at the code. But I really, really like it that you did it! I'll have a look ASAP. I don't like that you needed to change plainAddPlaceholder. It's so fragile that I'm affraid changes to it will easily break it. Also, would really love to have support for both pdfkit10 and pdfkit11. Can you check if it is possible to have them both? pdfkitAddPlaceholder and pdfkit11AddPlaceholder. Don't try to reuse code but rather copy and paste into a separate helper. At some point lerna will come in this lib and then such a change will make a lot of sense. Also it won't be a breaking change but a feature one if you did it this way. |
The changes to
I don't see why we couldn't do that and I'll find some time to look into that. |
This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm planning on getting back to this soon |
73be455
to
fd489fc
Compare
This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions. |
@vbuch any possibility of looking back into this? I was dead keen on using your library to add signature support to some PDFs I am generating via pdfkit (newer version as I require Acroform support), but discovered there's currently no support beyond version 0.10.0 (after a long day of digging through source code and trial and error). |
I've started splitting the packages with lerna so, once I'm done, this will be back in scope. Need to find the time. |
Hey @dhensby I'll have a look at your code here tomorrow and try to apply it on top of https://github.com/vbuch/node-signpdf/tree/feature/split |
Added support for v0.11 of PDFKit (which has added AcroForm support). Currently this library is incompatible with v0.11 as the relevant bootstrapping is not applied to the AcroForm.
Changes:
pdfkitAddPlaceholder
to use thePDFDocument.initForm()
andPDFDocument.formAnnotation()
APIsgetAcroForm
pdfKitMock
object inplainAddPlaceholder
to better refelect the APIs we depend onpdfKitMock._root.data.AcroForm
andpdfKitMock._acroform
when an AcroForm is presentpdfKitMock.initForm()
andpdfKitMock.formAnnotation()
methodspdfKitMock.ref()
changed to be the same asPDFDocument.ref()
- ie: it only acceptsdata
argpdfKitMock.ref()
doesn't immediately modify the PDF buffer, instead this happens all at once at the endpdfKitMock.ref()
now retains the data passed to itPDFKitReferenceMock
now stores "additional data" inside thedata
prop to more accurately reflect the way data is stored inPDFKitReference
pdfkitAddPlaceholder
no longer returnswidget
orform
properties as these are handled internally now and users do not need to call.end()
on them any more.Todo:
Add a test forgetAcroForm