Do you have any example from PDF to database

Hello,

I was found your website your software can control the fill, do you have any example for this
https://pdfjs.express/documentation/forms/fill-form-fields.

One more you have example for PDF field to Database or Ajax call?

Thank s

Hey there! Thanks for your interest in PDF.js Express.

PDF form data and annotations are serialized in XFDF format, which is just a XML like string that can imported/exported into the viewer.

To export the annotations into a XFDF string, you can use the exportAnnotations API.

WebViewer({...options}, ele).then(instance => {
   const { annotManager, docViewer } = instance;

   // Call this when you want to save
   const saveAnnots = async () => {
      const xfdfString = await annotManager.exportAnnotations();
      // send XFDF to server for saving via AJAX here
   }
})

Later on, to load those form fields, you can simply call importAnnotations.

WebViewer({...options}, ele).then(instance => {
   const { annotManager, docViewer } = instance;

   docViewer.on('documentLoaded', async () => {
     // load XFDF string from server here
     const xfdf = await fetchXFDFFromServer();
     await annotManager.importAnnotations(xfdf);
  })
})

If you have any more questions feel free to let me know.

Thanks,
Logan

Thank you for your help!

One more question.

I want to create the “input text box” field on pdf

When i click submit button can read the “input text box” field value"

Can you help and let me know to did it.

Thank you!!!

Hi,

Expres does not have the ability to create form fields on a PDF, it can only read existing ones. If you need the functionality to create form fields, you can take a look at our sister project. PDFTron WebViewer

If you have any more questions about this, feel free to open a new topic. (I am going to close this topic so it doesn’t get off topic)

Thanks!
Logan