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

cat command creates empty PDF #48

Open
hielsnoppe opened this issue Jun 24, 2022 · 0 comments
Open

cat command creates empty PDF #48

hielsnoppe opened this issue Jun 24, 2022 · 0 comments

Comments

@hielsnoppe
Copy link

Describe the bug
When I try to concatenate PDFs in an Express application, the resulting PDF is empty:

const documents = new Map();
documents.set('A', 'input1.pdf')
documents.set('B', 'input2.pdf')

const input_obj = Object.fromEntries(documents);
const cat_str = [ ... documents.keys()].join(' ');
const output = 'output.pdf';

pdftk
    .input(input_obj)
    .cat(cat_str)
    .output(output)
    .then(buffer => {
        // Do stuff with the output buffer
        documents.set('output', output)
        res.json(Object.fromEntries(documents))
    })
    .catch(err => {
        // handle errors
        res.json(err)
    });

The equivalent pdftk command on the command line succeeds:

pdftk A=input1.pdf B=input2.pdf cat A B output output.pdf

To Reproduce
Steps to reproduce the behavior:

  1. Run the above code
  2. Try opening output.pdf

Expected behavior
The generated file contains all input PDFs in the specified order.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version: 20.04.4 LTS (64-bit)

Additional context
N/A

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

No branches or pull requests

1 participant