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

173
Views
Filling out PDF form on browser using PDF-LIB

I have been trying to find a way to possible connect a front end to this javascript code to be able to fill out some contracts more efficiently

const {PDFDocument} = require('pdf-lib');
const { readFile, writeFile} = require('fs/promises');

const fs = require('fs')

async function createPDF(input, output) {
    try{
        const pdfDoc = await PDFDocument.load(await readFile(input));

        //Modify PDF, fill out
        const fieldNames = pdfDoc
            .getForm()
            .getFields()
            .map((f) => f.getName());
        console.log({ fieldNames });

        const form = pdfDoc.getForm();

        form.getTextField('Given Name Text Box').setText('Test');

        const pdfBytes = await pdfDoc.save();

        await writeFile(output, pdfBytes);
        console.log('PDF CREATED')
    } catch (err) {
        console.log(err);
    }
}

createPDF('OoPdfFormExample.pdf', 'output.pdf')

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!