Open Dmitrijs-Sakovics opened 7 months ago
Hi,
I haven't really used placeholder-pdfkit
. @dhensby would be best to reply here. But from what I see in the source signature
and widget
are already ended. Try to work around that maybe and only end the form
. Ideally, once you have it working, share your code and even better prepare a PR to introduce a placeholder-pdfkit
example.
@vbuch @dhensby Hi,
I managed to get this working with pdfkit 0.14.0 by removing the form.end()
statement (removing the whole foreach clause that .end()
s all the refs after the pdfkitAddPlaceholder
call)
While I am getting signed pdf-s out of it, I don't currently understand what's happening well enough to recommend this solution to others (hence no PR). It would be good if someone who knows the system could have a looks to see why this worked
I'm actually using pdfmake
and that uses @foliojs-fork/pdfkit
instead of the actual pdfkit
lib (probably because of all the problems that we've had previously with pdfkit
. Their implementation of AcroForms really messed up integration and I don't recall if we ever got round to fixing it or not.
I guess that pdfkit no longer needs the .end()
to be called and (if that's been taken from our examples) our examples may need updating!
We just don't have a pdfkit example. We have the pdfkit010 ones and I'm guessing that's what @Dmitrijs-Sakovics here based his example on. The pdfkit010 is obviously a legacy one so... yes, an example using pdfkit > 10 is needed.
Yes, my attempts were based on the pdfkit010 example since the pdfkit >0.10 helper readme states "This works in an identical way to the pdfkit010 package and the pdfkit010.js example is still relevant."
Describe the bug and the expected behaviour Using a very slightly modified example based on
packages\examples\src\pdfkit010.js
to create a signed pdf (code below, calling the function from an external file)The program is not throwing any errors, but gets stuck waiting for the
pdfReady
promise to resolve. thepdf
stream emits the "data" event 59 times, but does not emit the "end" event (hence the promise not resolving). The "error" event does not get emitted either.Commenting out the call to
pdfkitAddPlaceholder
(and the.end()
-ing of the new refs) resolves the problem (but the signing process fails because the placeholder is missing)Tried with pdfkit 0.11.0 and 0.14.0; under nodeJS 18.17.0 and 20.11.1
Is it a bug in signing or in the helpers? Helper: placeholder-pdfkit
To Reproduce