Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
Can't get stdout of execSync(`pdftk ${fileName} dump_data_fields`)

I'm trying to get the output of pdftk command with execSync. Here is the code:

const { execSync } = require('child_process');
const result = execSync(`pdftk ${fileName} dump_data_fields`);

After execution result contains an empty Buffer. At the same time if I set the output option to inherit {stdio: 'inherit'} the output of the command will be printed to console, so the command works fine. Here is a full code of such case:

const { execSync } = require('child_process');
execSync(`pdftk ${fileName} dump_data_fields`,{stdio: 'inherit'});

Also simple commands like echo Hello world works fine and it's output stored in result.

What I'm doing wrong with the pdftk command?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!