Imposing Dynamic Text on Images

Product: PDFTron Server

Product Version: Latest

Thanks in advance. I cannot find a documented solution path for the following:

  1. A document template that consists of:
    a. a background image (the image of the original paper form)
    b. a set of overlaid field placeholders (e.g., person[0].name.first, requestType, requestDate, etc.) with specific location, geometry (size), and font options (font, default size, color)
  2. A system process that:
    a. loads the template
    b. fills template field placeholders with actual values from the current request data
    i. Note: Optionally, font size should be automatically adjusted so data fits field
    c. produces a final PDF with the image and filled data (any unfilled placeholders are invisible)

For those familiar with Jasper Reports, this is a standard use-case for Jasper and accomplished in a straightforward manner (not that it is perfectly clean there, either).

I think perhaps going down the route of fillable PDF Forms may be the only option, but not sure that everything mentioned above is achievable with that route. Also, it would require that we manually create PDF Fillable forms.

Thanks in advance for any information!

Hi,

For Dynamic PDF generation, please view the following Office Template Guide:

Another option is for you to use Windward Studios. They have an industry leading templating engine as well. For more information:

Please let me know how this works for you, and if you have any further questions.

Thanks, but there is nothing in there that answers my question. It would be a nightmare to try to exactly position a lot of fields on top of an image background in MS Word, unless I am missing something – if I am, please point directly to it. I’ve already spent time going through all of your docs without finding a clear answer, as originally noted. Thanks!

One potential way is to manually add them on top using the following webviewer sample:

Please take a look and let me know if that is of any use for you.

Yes, thank you! I think that works for the use-case:

  1. Create initial PDF with background image
  2. Use WebViewer to add the required fields
  3. Download document as fillable PDF
  4. Use fillable PDF as template

I guess it is a limitation of PDF that you can’t have the same piece of data used multiple times. For example, if I have a form where my name must be repeated multiple times, I cannot define a single field for “participantName” and then impose that 5 times (for example) throughout the form. Is that correct?

The PDF specification directly and specifically supports this. FormFields are document wide and are not viewed on the PDF. Annotation Widgets are used to represent them which sets up a nice way to impose the same field throughout.

First you can create a field using the below FieldCreate API:
https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.PDFDoc.html#pdftron_PDF_PDFDoc_FieldCreate_System_String_pdftron_PDF_Field_Type_

Second you can create the widget using the Create method and by inputting the Field you previously created. You can reuse the same field as many times for different widgets:
https://www.pdftron.com/api/PDFTronSDK/dotnet/pdftron.PDF.Annots.TextWidget.html#pdftron_PDF_Annots_TextWidget_Create_pdftron_PDF_PDFDoc_pdftron_PDF_Rect_pdftron_PDF_Field_

Let me know if that answers your question.

Thanks again. I see how that could work – but we’ve lost the interactive capability inherent in using WebViewer to create the fields. Someone, somehow, has to map document coordinates to the widgets and then data fields to the widgets. I was hoping there was something that allowed that to be done interactively as part of PDFTron.