Expand my Community achievements bar.

AEM Forms Designer PDF Preview not showing data

Avatar

Level 2

I have finally gotten Forms Designer (v6.5) installed on my Windows 10 Enterprise PC at work, have opened an existing PDF, attached an XML source file and mapped the fields, but do no see any of the data mapped to the fields in PDF Preview.

Any documentation I've been able to find leaves much to be desired. I can't find an internal contact and I'm not getting any response from our Adobe rep so I'm turning to the community in hopes that someone can point me in the right direction: requirements (do I need Acrobat Pro or some extension to make this work with Forms Designer)? Is there something I need to do with the PDF prior to attaching the XML source?

 

Thanks in advance.

13 Replies

Avatar

Level 2

Thank you! I am now seeing data for one form.

 

My next question would be: if my `xml` data has say 300 row elements (separate forms), what's the procedure for outputting all of those individual forms?

Avatar

Employee Advisor

If you have access to aem forms server, you can use output service to generate multiple documents from one data file

Avatar

Level 3

Just a question about your setup.

Do you have a flowed container that has all of the repeated elements underneath it?

That container would need to be bound to the repeated data element that all the other data is under.

I will stop there in case you already set it up that way.

Avatar

Level 2

I'm not sure I'm following re: `flowed container`. Each of the 999 <row> elements have the same elements within.

 

Because this was originally set up to collect groups of 999 "people" per xml file - looping through the 100K+ records, I continued with that same design idea, but looking at it for a while has made me rethink things.

 

Rather than breaking them up, collect all 100K+ rows (which come out of the Oracle query as xml), then looping through them one at a time, creating the PDF from the XDP file and saving them individually as unique PDFs.

 

Still waiting on some clarification on the directives though. 

Avatar

Community Advisor

Saving each individual pdf per record in the xml data is possible through AEM forms output service, you will not achieve this with AEM designer.

Avatar

Level 2

I'm trying to accomplish this using a C# console application that I've built.

 

I have aliased the columns in query that uses the getxml() method from Oracle to have the same column names as the XDP form.
When I preview the form in Designer, it automatically maps the data correctly so when I preview it, the first <row>...</row> record displays in the preview.

 

The pseudo code would be something like this:
Open `XDP`
Open `XML`
Loop reading a single <row>{all elements mapped to `XDP`}</row>

Save as `PDF` (using something like `iText`)

Continue through all <row> nodes

Close `XML`

Close `XDP`

 

Does that make sense and does anyone have experience with this?

 

Thanks!

Avatar

Level 2

I'm so close! I am using iText but am getting a `PDF header not found`

Avatar

Level 2

I've hit a wall and am looking for some direction.

 

  1. I have altered the database query to generate the xml data with element names that match the form names.
  2. I have both an XDP and PDF template and have set the data source as the XML file and the `Preview` data source to the same.
  3. I have it looping through each each row and subsequent element, creating a named PDF using data from the XML.

This is where the problem arises. I am using iText v8.0.5 with the following snippet:

using (PdfDocument pdfDoc = new PdfDocument(new PdfReader(templatePathPDF), new PdfWriter(pdfOutputPath)))
{
    PdfAcroForm form = PdfAcroForm.GetAcroForm(pdfDoc, true);

    // Fill the form fields with XML data
    foreach (XmlNode element in row.ChildNodes)
    {
        form.GetField(element.Name)?.SetValue(element.InnerText);
    }

    pdfDoc.Close();
}

 

Here it loops through all the fields and there values correctly but does not `SetValue` for any fields. From this, I backed up and added some debugging to `GetAllFormFields()` and write their `keys` to the console - which produces nothing. I'm leaning towards my lack of understanding on how XDPs and PDFs differ, but would think I if I can access the form, I should be able to at least list out the form fields.

 

Any thoughts (aside from addon service) would be greatly appreciated.

Avatar

Level 2

I've gotten one step closer but now the generated PDF will not open; I get the following error message in Acrobat:

`The document you are trying to load requires Adobe Reader 8 or higher. You may not have the
Adobe Reader installed or your viewing environment may not be properly configured to use
Adobe Reader.`

I have the most up-to-date Reader installed but read something about PDFs created within AEM Forms Designer do not format things correctly.

If I try using the XDP file rather than a PDF, I get an error that the header doesn't exist.
Does anyone have ideas on what I'm missing?

 

Thanks in advance.

Avatar

Employee Advisor

Are you in PST time zone?

if so we can connect and do a web session sometime today

Avatar

Level 2

CST, but thank you. I will go through the link Vijay_Katoch sent but will like to reach back out if I have issues?