PDF Form flatten

Posted by: holger.keller on 12 February 2024, 6:57 am EST

  • Posted 12 February 2024, 6:57 am EST

    I am evaluating your PDF Document solution.

    We have the following use case:

    We want to pre-fill programatically a PDF form and then display it in the Pdf Viewer.

    The user should fill in further fields and then sign the form with the graphical signing tool.

    The PDF document should then be flattened and saved on the server.

    We call the API function ‘OnDocumentModified’.

    How can I flatten the Pdf document when saving it?

    Thanks

  • Posted 18 February 2024, 7:57 pm EST

    Hello,

    We are sorry for the inconvenience for the delayed response on this. It seems that you are able to pre-fill the data in the PDF before showing to the PDF.

    And now you are looking how you may flatten the PDF on saving. If yes, please use the custom save button and call the following code snippet before saving the PDF changes.

    v=DsPdfViewer.findControl("#viewer")
    v.annotations.then(function (result) {
      for(let i=0;i<result.length;i++){
          var annotaions = result[i].annotations;
          for(j=0;j<annotaions.length;j++){
              annotaions[j].convertToContent = true;
          }
          v.updateAnnotations(result[i].pageIndex,annotaions);
      }  
    })

    Custom Save Button Sample:

    https://developer.mescius.com/document-solutions/javascript-pdf-viewer/demos/ui-customization/save-changes/purejs

    We want to pre-fill programatically a PDF form and then display it in the Pdf Viewer.

    If you are facing any issue in above. Please do elaborate your scenario. How the PDF is created and how you would like to fill the data for the PDF.

    Regards,

    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels