Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Re-render or flaten PDF form after the form has filled and send its XML data to a specific folder

Avatar

Former Community Member

Hello Everyone,

Does any one know if it possible to re-render or flaten the pdf form after the user has filled it to send to a specific folder along with its XML data? If so, can you please provide some hints on how to start or any example would be appreciated.

e.g. The user filled the form on workspace then when he/she presses on completed, the form will be flatten as a pdf and generate an xml file to send to a specific location on the server.

Thanks in advance,

Han Dao

21 Replies

Avatar

Level 10

It's certainly possible.


After the submission, you can extract the data as XML, use Output to "flatten" your document and the File Utilities service to save the data and/or the PDF to the file system (server file system).

Jasmin

Avatar

Former Community Member

Hello Jasmin,

From your suggestion, do you mean that can do the following components: Common> exportData to extract the data as XML, Output > TransformPDF to flatten the document, and FileUtilsService > Write Document to save the data and the PDF to the file system?

Can you please explain a little bit more details on the extract XML data and flatten the pdf document.

Thanks,

Han Dao

Avatar

Level 10

That's what I'm saying.

You could also just submit the xml to avoid having to extract the data and then create a flat PDF using Output->GeneratePrintedOutput

Jasmin

Avatar

Former Community Member

Jasmin,

The users want to save the xml and pdf to the same folder, can "submit the xml" work for that? I see the option "Submit to URL" but not the option that I can put the folder path to save the xml data for the submit button. 

Thanks,

Han

Avatar

Level 10

If you use a submit button, you'll submit back to a server.

Do they want to save on their local machine? If that's the case, then just do a regular save for the PDF and a Form/Manage Form Data/Export Data to get the XML.

If it's on the server you can either submit the PDF and extract the data, or just submit the data and reconstruct the PDF.

Jasmin

Avatar

Former Community Member

Well, actually after submission, they want to save a flatten pdf form and the extracted data to some network shared-folder. That's where I am confusing on which components would be fit for this type of request. I tried a couple ways to do but I can only get the extracted xml but not both.

Thanks,

Han

Avatar

Level 10

Just submit the PDF back, then use Common->ExportXML to get the XML. You'll gave both.

Jasmin

Avatar

Former Community Member

Hi Jasmin,

I keep getting the below when try to use the Output > GeneratePDFOutput at the point where the ContentRoot is. Can you please take a few minute to look at my process? If so, can you please provide your email address since the attach file is no longer available here.

[11/9/10 13:20:15:680 CST] 000000bb WorkflowDSCIn E com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker logFailedFaultRouting An exception was thrown with name com.adobe.livecycle.output.exception.OutputException message:ALC-DSC-000-000: com.adobe.idp.dsc.DSCException: Internal error. while invoking service OutputService and operation generatePDFOutput and no fault routes were found to be configured.

Thanks,

Han Dao

Avatar

Level 10

Can you post the configuration settings for the GeneratePDFOutputoperation?

Jasmin

Avatar

Former Community Member

Hi Jasmin,

Here is the print screen of the setting.

GeneratePDF1.JPG

screen 2

GeneratePDF2.JPG

Avatar

Level 10

If you just want to flatten an existing PDF, use the tranformPDF operation from the Output service.

If you want to create a flat pdf from an XDP, then use the generatePDFOuput.

I beleive  you need to use transformPDF in your case.

Jasmin

Avatar

Former Community Member

Well, I think I would use the generatePDFOutput since I need to create a flat pdf from an XDP.

Thanks,

Han Dao

Avatar

Level 8

Can you post the entire stack trace from your server log?


Avatar

Former Community Member

Hi Hodmi,

Here is the log:

[11/10/10 9:34:30:814 CST] 000003ba FormServerExc W com.adobe.livecycle.formsservice.logging.FormsLogger logMessage ALC-OUT-002-058: Cannot retrieve the resource from Repository Path. Authority component retrieved is "null". Path component retrieved is "/TSD-Test/<".Underlying Exception is : ALC-REP-018-000: Resource [/TSD-Test/<?xml version="1.0" encoding="UTF-8"?><?xfa generator="XFA2_4" APIVersion="3.0.10148.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2010-11-09T19:44:25Z" uuid="268f7766-6689-4295-86c1-333f7cf423bb">
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><xfa:data><FSFIELDS_><__fieldnode__/><FSTARGETURL_/><AWS_AS...>
<execEvent activity="preSubmit" context="form1[0].#subform[0].FSSUBMIT_[0]"/>
<pdf xmlns="http://ns.adobe.com/xdp/pdf/" href="2164780174736034193-100.pdf"/>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><annots/></xfdf></xdp:xdp>] does not exist or you do not have sufficient rights to access it.
[11/10/10 9:34:30:814 CST] 000003ba RenderFormExc E com.adobe.livecycle.formsservice.logging.FormsLogger logMessage ALC-OUT-002-035: Failed to load TemplateStream for FormQuery=<?xml version="1.0" encoding="UTF-8"?><?xfa generator="XFA2_4" APIVersion="3.0.10148.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2010-11-09T19:44:25Z" uuid="268f7766-6689-4295-86c1-333f7cf423bb">
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><xfa:data><FSFIELDS_><__fieldnode__/><FSTARGETURL_/><AWS_AS...>
<execEvent activity="preSubmit" context="form1[0].#subform[0].FSSUBMIT_[0]"/>
<pdf xmlns="http://ns.adobe.com/xdp/pdf/" href="2164780174736034193-100.pdf"/>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><annots/></xfdf></xdp:xdp> from location URI =repository:///TSD-Test/.
[11/10/10 9:34:30:923 CST] 000003ba WorkflowDSCIn E com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker logFailedFaultRouting An exception was thrown with name com.adobe.livecycle.formsservice.exception.ProcessFormSubmissionException message:com.adobe.livecycle.formsservice.exception.FormServerException: Stream does not represent a PDF document. while invoking service FormsService and operation processFormSubmission and no fault routes were found to be configured.
[11/10/10 9:34:31:032 CST] 000003ba JobManagerBea E com.adobe.idp.jobmanager.ejb.JobManagerBean doOnMessage JobManagerBean:onMessage():Exception:ALC-DSC-003-000: com.adobe.idp.dsc.DSCInvocationException: Invocation error.

Thanks,

Han Dao

Avatar

Level 8

It looks like you are trying to pass in the actual document in the inputPdf variable.  LiveCycle is looking for a string with the document's name.  It combines the String in the contentRoot parameter with the string in the Form variable to create a path to the document.

Avatar

Former Community Member

Hi Hodmi,

I think I got the previous issue fixed but I then jump to another issue. It did generate the pdf file but when I try to open it I got the below error. Can you please advise. Thanks.

cannot read pdf.JPG

Avatar

Level 10

Try to save it to the file system and look at the content of the file to see what it really contains. Just use notapad to see if the pdf is actually a PDF or something else.

Jasmin

Avatar

Former Community Member

If try to open that pdf file in notepad then I get the following text:

<?xml version="1.0" encoding="UTF-8"?><xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" timeStamp="2010-11-09T19:44:25Z" uuid="268f7766-6689-4295-86c1-333f7cf423bb">
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><xfa:data><FSFIELDS_><__fieldnode__/><Name>syhstem</Name><A...>
<pdf xmlns="http://ns.adobe.com/xdp/pdf/" href="2164780174736034193-117.pdf"/>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><annots/></xfdf></xdp:xdp>

Avatar

Level 8

Looks like the document is not rendered.  The file still looks like an XDP and not a PDF

Avatar

Former Community Member

Does that means I need to add another step to re-render that xdp form?

Thanks,

Han Dao