nrhirani / node-qpdf

A Content Preserving transformations on PDFs wrapped around QPDF
MIT License
51 stars 54 forks source link

Invalid password when password is empty on Windows #6

Open jsanko9 opened 6 years ago

jsanko9 commented 6 years ago

Hello, I had a problem with blank password. First, you need to set double quotation marks so you don't get invalid password message. This may not be huge, but accepting blank string would be preferred.

Secondly, On Windows I believe there is problem with quotation marks.

I have resolved this by passing another argument to spawn command: {windowsVerbatimArguments: true}

This was based on this discussion https://github.com/nodejs/node/issues/5060#issuecomment-179488013

In your case you would need to replace following: 107: child = spawn(args[0], args.slice(1)); with 107: child = spawn(args[0], args.slice(1),{windowsVerbatimArguments: true});

Thank you for your work.

dimlucas commented 5 years ago

I managed to overcome this issue by forking the project and removing the check for missing password on line 8 in index.js

As a suggestion, I believe a skipPassword flag would be more appropriate

nrhirani commented 5 years ago

@dimlucas / @jsanko9 Would like to submit a PR?