title: Filling out PDF form on browser using PDF-LIB
body: <p>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</p>
  <pre><code>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) =&gt; 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')
  
  </code></pre>