Populate LiveCycle pdf with ColdFusion, but no fieldnames in the PDF

222 views Asked by At

I'm trying to fill in a PDF with query data using ColdFusion. I think it does not have field names. Is there any way I can still use cfpdfformparam to fill it in?

The PDF was created with LiveCycle and I cannot modify it, it comes from https://www.formulaires.modernisation.gouv.fr/gf/cerfa_10069.do

When I run this on the pdf:

<cfpdf action="getInfo" source="cerfa_10069.pdf" name="PDFInfo">
<cfdump var="#PDFInfo#" >

<cfpdfform source="cerfa_10069.pdf" result="resultStruct" action="read"/>
<cfdump var="#resultStruct#" >    

it returns a struct showing

topmostSubform  
   struct
      Champ_de_texte1   
        array
        1   N° 10069*04
        2   [empty string]
        3   [empty string]
        4   [empty string]

with 24 fields unnamed but numbered. If I could figure out the order of the fields, could I fill them in using just the number? But this below does not work:

<cfpdfsubform name="topmostSubform"> 
    <cfpdfsubform name="Champ_de_texte1"> 

           <cfpdfformparam name="17" value="572 Evergreen Terrace"> 

    </cfpdfsubform> 
</cfpdfsubform>

I only need to fill in the PDF's form fields with data, not submit the form.

1

There are 1 answers

0
Leigh On

Use the index attribute of cfpdfformparam:

<cfpdfform action="populate" source="c:/path/to/cerfa_10069-04.pdf" 
         destination="c:/path/to/updatedForm.pdf">
    <cfpdfsubform name="topmostSubform"> 
        <cfpdfformparam name="Champ_de_texte1" index="1" value="572 Evergreen Terrace" /> 
        <cfpdfformparam name="Champ_de_texte1" index="2" value="Foo" /> 
        <cfpdfformparam name="Champ_de_texte1" index="3" value="Bar" /> 
        ...
    </cfpdfsubform>
</cfpdfform>