You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off - thank you John for this amazing library! It's made Hummus much easier.
I'm trying to add text to an existing PDF that is protected with a user password and leave the password protection in place while making changes.
Everything goes well until I call endPDF(), which triggers the following error:
TypeError: unable to create copying context. verify that the target is an existing PDF file
The hummus-error.log says this:
PDFDocumentHandler::StartCopyingContext, Cant decrypt document. make sure to provide appropriate password for this document in order to copy from it
It seems the error happens when endPDF() calls this._writeInfo(), which calls hummus's writer.createPDFCopyingContext(), an older Hummus function that doesn't seem to accept a password.
For my own purposes, when I comment out the writeInfo call, everything seems to work okay, but I'm guessing writeInfo may be important for other use cases.
In a future update, would it make sense to make the writeInfo step optional somehow? (e.g. as an option when calling endPDF or when instantiating HummusRecipe). Or maybe there's an easier way that I'm not seeing. In any case, I wanted to capture the issue and the potential workaround.
First off - thank you John for this amazing library! It's made Hummus much easier.
I'm trying to add text to an existing PDF that is protected with a user password and leave the password protection in place while making changes.
Everything goes well until I call
endPDF()
, which triggers the following error:TypeError: unable to create copying context. verify that the target is an existing PDF file
The hummus-error.log says this:
PDFDocumentHandler::StartCopyingContext, Cant decrypt document. make sure to provide appropriate password for this document in order to copy from it
It seems the error happens when
endPDF()
callsthis._writeInfo()
, which calls hummus'swriter.createPDFCopyingContext()
, an older Hummus function that doesn't seem to accept a password.hummusRecipe/lib/Recipe.js
Line 206 in 198f9b8
hummusRecipe/lib/info.js
Line 33 in 198f9b8
For my own purposes, when I comment out the
writeInfo
call, everything seems to work okay, but I'm guessing writeInfo may be important for other use cases.In a future update, would it make sense to make the writeInfo step optional somehow? (e.g. as an option when calling endPDF or when instantiating HummusRecipe). Or maybe there's an easier way that I'm not seeing. In any case, I wanted to capture the issue and the potential workaround.
Here is a sample PDF file with user password '123123' for testing: https://www.dropbox.com/s/vcodzkyv5s67mp3/pdf-with-password-123123.pdf?dl=1
The text was updated successfully, but these errors were encountered: