vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
696 stars 175 forks source link

Fixed problem on plainAddPlaceHolder #86

Closed ifuschini closed 3 years ago

ifuschini commented 4 years ago

This is the problem

When I using the method "plainAddPlaceHolder" i see that all fields defined as new String('something') are empty.

For example:

                pdfBuffer = plainAddPlaceholder({
                    pdfBuffer,
                    reason: 'I have reviewed it.',
                    signatureLength: 1612,
                        }); 

inside the pdf this is the result:

image

This is my solution I have changed the row 78 in node-signpdf/dist/helpers/pdfkit/pdfobject.js from:

stringBuffer = Buffer.from(string,'ascii'); to:

stringBuffer = Buffer.from(string.toString(),'utf8');

and now the result is correct:

image

stale[bot] commented 3 years ago

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.