Skip to content
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

Add --replace-input flag for saving as a same name. #26

Closed
HarshilSySCreations opened this issue Jan 6, 2023 · 2 comments · Fixed by #27
Closed

Add --replace-input flag for saving as a same name. #26

HarshilSySCreations opened this issue Jan 6, 2023 · 2 comments · Fixed by #27

Comments

@HarshilSySCreations
Copy link

Hi @Sparticuz ,

Many thanks for maintaining this repo. It's been a great help.
Here I would like to request a feature to add --replace-input flag to allow users to save password-protected files with the same name so that we don't have to delete old password-less files.

here is the error that I've got,

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "
qpdf: input file and output file are the same; use --replace-input to intentionally overwrite the input file

code snippet:

      setTimeout(() => {
        try {
          const passProtectedPDF = async (): Promise<any> => {
            console.log('[*] into passProtectedPDF!');
            const pdf = {
              input: pdfFile,
              output: pdfFile,
              password: getHCNo,
            };
            await qpdf2.encrypt(pdf);
            console.log('[*] end of passProtectedPDF!');
          };
          console.log('[*] passProtectedPDF called!');
          resolve(passProtectedPDF());
        } catch (err) {
          console.log(err);
        }
      }, 1000);
@Sparticuz
Copy link
Owner

Thanks for the issue! I've released this in v4.1.0.

@HarshilSySCreations
Copy link
Author

Thanks for the issue! I've released this in v4.1.0.

Wow, what a speed. Respect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants