• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cfpdfform populate not working

New Here ,
Oct 04, 2024 Oct 04, 2024

Copy link to clipboard

Copied

We have using the cfpdfform to populate the xmldata on the pdf, suddenly it stopped working. when we try to read the same pdf using the cfpdfform function it displays the content in struct. but when we open the pdf it shows blank. We are using coldfusion 2023 patch update upto 8. we haven't made any code changes recently, but it stop working suddenly after 30th Sept.

Views

833

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2024 Oct 04, 2024

Copy link to clipboard

Copied

Did you stop and restart CF immediately prior to that? Do you see anything in the error logs after that? Is this happening in multiple environments, or just this server? If you have multiple environments, can you update CF to update 10 on one of them and retry?

 

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 04, 2024 Oct 04, 2024

Copy link to clipboard

Copied

i have tried restarting coldfusion server, it is not working. initially, i tried in cf patch update 10, after i thought it might be patch update and unistall that still it shows blank pdf. we have 3 environment 2 prod and one dev. all 3 environment showing blank pdf. two prod using cf 2023 patch update 8. in dev we tried cf 2023 patch update 10, even uninstall patch update upto 6 and tried in dev still showing blank pdf.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2024 Oct 04, 2024

Copy link to clipboard

Copied

Did you check the error logs?

 

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 06, 2024 Oct 06, 2024

Copy link to clipboard

Copied


@sathiyanarayanan_7692 wrote:

i have tried restarting coldfusion server, it is not working. initially, i tried in cf patch update 10, after i thought it might be patch update and unistall that still it shows blank pdf. we have 3 environment 2 prod and one dev. all 3 environment showing blank pdf. two prod using cf 2023 patch update 8. in dev we tried cf 2023 patch update 10, even uninstall patch update upto 6 and tried in dev still showing blank pdf.

 


 

When I looked at this some more, I found something that might be a clue. The packages htmltopdf and pdf were updated in update 7 and again in update 8. That suggests a test you could do: re-install the packages and see what happens.

 

Assuming your Operating System is Windows, the steps are (to be carried out in your development or test environment, not in production) :

  1.  Update ColdFusion to at least update 8 (where the issue began), but preferably to the latest update level, which is, update 10. 
  2.  Open the command prompt (CMD) as administrator;
  3.  Use the DOS command CD to navigate to C:\ColdFusion2021\cfusion\bin;
  4.  Type cfpm.bat and press ENTER. That should bring up ColdFusion's Package Manager tool.
  5.  Type install all and press ENTER. When ColdFusion finishes, the Package Manager would have installed the updated versions of all the packages, including those relevant to PDF.
         Type quit and press ENTER. 
         Close the CMD window.
  6.   Restart ColdFusion 2023.

    Test to see if the PDF issue has been resolved.  Share the test result with the forum.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 08, 2024 Oct 08, 2024

Copy link to clipboard

Copied

Thanks for this steps, i have tried this in Dev with the latest patch update 10. still we are experiencing the same thing.

 

 I have also shared the portion of our code. Please take a look.
 
<cfset xmldata='<?xml version="1.0" encoding="UTF-8"?>
<xfa:datasets
    <xfa:data>
        <F>          
            <P1>            
                <ordDate>10/02/2024</ordDate>
                <ordReqFillDate>10/02/2024</ordReqFillDate>
                <ordCost_Ctr>999999</ordCost_Ctr>
                <FlrUnit>Acute 9 East</FlrUnit>
                <ordFilledBy/>
                <ordCheckedBy/>
                <Misc1>Cocoa mix, 50 pkt per box</Misc1>
                <MiscAmt1>10</MiscAmt1>
                <Misc2>Coffee Creamer 12 oz</Misc2>
                <MiscAmt2>20</MiscAmt2>
                <ordby>Manimaran, Sathiyanarayanan</ordby>
            </P1>
        </F>
    </xfa:data>
</xfa:datasets>'/>



   

    <cfpdfform
    source="c:\inetpub\wwwroot\nourishments\1342NS.pdf"
    destination="c:\inetpub\wwwroot\nourishments\Processing\temp\order_test2.pdf"
    action="populate" XMLdata="#xmlparse(xmldata)#" />

    <cfpdfform  action="read"  source="c:\inetpub\wwwroot\nourishments\Processing\temp\order_test2.pdf" result="test" />
    <cfdump var = "#test#" />
   
   
    <embed src="/nourishments/Processing/temp/order_test2.pdf" style="border:1px solid black;width:815px;height:1060px;" />


We expect some data needs to be prefilled from the xml data to the pdf: ex-highlighted one.
 

 

 

pdf_expected fields.PNGCfpdfform_Read.png

In that code, we have try to read the created pdf, the output pasted above. also shared the code snippet

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2024 Oct 04, 2024

Copy link to clipboard

Copied

I hope Dave's suggestion solves the problem.

If it doesn't, then please share your code so we can better understand the issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2024 Oct 09, 2024

Copy link to clipboard

Copied

Thanks for sharing the code, @sathiyanarayanan_7692 . I have been experimenting with your code, using a form that I created myself (attached), in combination with various XFA versions of your XML file.

(Mind you, the referenced page contains an error. The final closing tag of the last XML should be "</xfa:data>", not "</xfa>" . I have reported the error to Adobe.) Thought I'd share my experiences after going at it for some hours.

 

My test code, together with the latest version of the XML, follows :

<!--- Specify the XML file to populate a PDF form. ---> 
<cfset formdata='<?xml version="1.0" encoding="UTF-8"?>
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">  
	<xfa:data> 
		<form1>        
	        <ordDate>10/02/2024</ordDate>
	        <ordReqFillDate>11/02/2024</ordReqFillDate>
	        <ordCost_Ctr>999999</ordCost_Ctr>
	        <FlrUnit>Acute 9 East</FlrUnit>
	        <ordFilledBy></ordFilledBy>
	        <ordCheckedBy></ordCheckedBy>
	        <Misc1>Cocoa mix, 50 pkt per box</Misc1>
	        <MiscAmt1>10</MiscAmt1>
	        <Misc2>Coffee Creamer 12 oz</Misc2>
	        <MiscAmt2>20</MiscAmt2>
	        <ordby>Manimaran, Sathiyanarayanan</ordby>
        </form1>
    </xfa:data>	
</xfa:datasets>'/>
	
<cfset xmlFormData=xmlParse(formdata)> 

<!---<cfdump var="#xmlFormData#" abort="true">--->

<!--- Polpulate PDF form with XML data --->
<cfpdfform source="#expandpath('prefilledform.pdf')#" 
destination="#expandpath('filledform.pdf')#" action="populate" XMLdata="#xmlparse(formdata)#" overwrite="yes"/>

<!---
<cfpdfform  action="read"  source="#expandpath('filledform.pdf')#" result="test" />
    <cfdump var = "#test#" />
 --->

Result:

The file filledForm.pdf is created, but its fields are all empty.

All the form fields in <cfdump var = "#test#" /> are also empty.

 

Nevertheless, I can suggest a workaround (that works!):

<!--- Specify the XML file to populate the PDF form. ---> 
<cfset formdata='<?xml version="1.0" encoding="UTF-8"?>
	<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
	    <xfa:data>
	        <F>          
	            <P1>            
	                <ordDate>10/02/2024</ordDate>
	                <ordReqFillDate>11/02/2024</ordReqFillDate>
	                <ordCost_Ctr>999999</ordCost_Ctr>
	                <FlrUnit>Acute 9 East</FlrUnit>
	                <ordFilledBy/>
	                <ordCheckedBy/>
	                <Misc1>Cocoa mix, 50 pkt per box</Misc1>
	                <MiscAmt1>10</MiscAmt1>
	                <Misc2>Coffee Creamer 12 oz</Misc2>
	                <MiscAmt2>20</MiscAmt2>
	                <ordby>Manimaran, Sathiyanarayanan</ordby>
	            </P1>
	        </F>
	    </xfa:data>
	</xfa:datasets>'/>
	
<cfset xmlFormData=xmlParse(formdata)> 

 <!--- Access the elements inside the XML and get their values. If element not found, set the value to empty string.  --->
<cfset ordDate = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.ordDate.xmlText ?: "">
<cfset ordReqFillDate = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.ordReqFillDate.xmlText ?: "">
<cfset ordCost_Ctr = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.ordCost_Ctr.xmlText ?: "">
<cfset FlrUnit = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.FlrUnit.xmlText ?: "">
<cfset ordFilledBy = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.ordFilledBy.xmlText ?: "">
<cfset ordCheckedBy = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.ordCheckedBy.xmlText ?: "">
<cfset Misc1 = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.Misc1.xmlText ?: "">
<cfset MiscAmt1 = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.MiscAmt1.xmlText ?: "">
<cfset Misc2 = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.Misc2.xmlText ?: "">
<cfset MiscAmt2 = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.MiscAmt2.xmlText ?: "">
<cfset ordby = xmlFormData["xfa:datasets"]["xfa:data"].F.P1.ordby.xmlText ?: "">  
   
 <cfpdfform action="populate" source="#expandpath('prefilledform.pdf')#" destination="#expandpath('filledform.pdf')#" overwrite="yes">
<cfpdfformparam name="ordDate" value="#ordDate#">
<cfpdfformparam name="ordReqFillDate" value="#ordReqFillDate#">
<cfpdfformparam name="ordCost_Ctr" value="#ordCost_Ctr#">
<cfpdfformparam name="FlrUnit" value="#FlrUnit#">
<cfpdfformparam name="ordFilledBy" value="#ordFilledBy#">
<cfpdfformparam name="ordCheckedBy" value="#ordCheckedBy#">
<cfpdfformparam name="Misc1" value="#Misc1#">
<cfpdfformparam name="MiscAmt1" value="#MiscAmt1#">
<cfpdfformparam name="Misc2" value="#Misc2#">
<cfpdfformparam name="MiscAmt2" value="#MiscAmt2#">
<cfpdfformparam name="ordby" value="#ordby#">
</cfpdfform>

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2024 Oct 09, 2024

Copy link to clipboard

Copied

To add to my last post, I am on ColdFusion 2023, Update 10 (on Windows 10 Pro)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 10, 2024 Oct 10, 2024

Copy link to clipboard

Copied

To get Adobe's ColdFusion team to look into this, I have just created a bug ticket: https://tracker.adobe.com/#/view/CF-4223960 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2024 Oct 14, 2024

Copy link to clipboard

Copied

Thanks @BKBK , i have tried the work around in my test environment but its not working. i have checked with the coldfusion support team, XML data is working for them. I have tried cf 2023 patch update from 6 to 10, the pdf issue is still there. did i miss anything on the set up ? or will reinstall the coldfusion will work. Please let us know your thoughts. it affecting the bussiness. users getting frustrated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

If you shared the PDF form, I could help in testing it. If the form contains private or sensitive information, then send me a download link for it by Private Message. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

this is the source file, we have uninstall and re-install the coldfusion 2023 but still it not working. we have found another lead that on the day of pdf issue started, there was an windows update happens on our servers, we think that might happens also shared the security update for microsoft windows KB5043051 & KB5043124

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

we were try to uninstall the updates but its unsuccessful, 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

@sathiyanarayanan_7692 , I tested using the file you shared (1342NS.pdf). The form was filled.

 

The steps in the test:

  1.  Place the file fillFormWithXML.cfm and 1342NS.pdf in the same directory under the root.
  2.  Launch the file fillFormWithXML.cfm. As a result, ColdFusion fills the form in the PDF, and creates the filled form 1342NSfilled.pdf within the same directory.
  3.  To check, launch the file readXmlFilledForm.cfm. The result is a struct of the data.

 

fillFormWithXML.cfm

<!--- Specify the XML file to populate a PDF form. ---> 
<cfset formdata='<?xml version="1.0" encoding="UTF-8"?>
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">  
	<xfa:data> 
		<form1>        
	        <ordDate>10/02/2024</ordDate>
	        <ordReqFillDate>11/02/2024</ordReqFillDate>
	        <ordCost_Ctr>999999</ordCost_Ctr>
	        <FlrUnit>Acute 9 East</FlrUnit>
	        <ordFilledBy></ordFilledBy>
	        <ordCheckedBy></ordCheckedBy>
	        <Misc1>Cocoa mix, 50 pkt per box</Misc1>
	        <MiscAmt1>10</MiscAmt1>
	        <Misc2>Coffee Creamer 12 oz</Misc2>
	        <MiscAmt2>20</MiscAmt2>
	        <ordby>Manimaran, Sathiyanarayanan</ordby>
        </form1>
    </xfa:data>	
</xfa:datasets>'/>
	
<cfset xmlFormData=xmlParse(formdata)> 

<!--- Polpulate PDF form with XML data --->
<cfpdfform source="#expandpath('1342NS.pdf')#" 
destination="#expandpath('1342NSfilled.pdf')#" action="populate" XMLdata="#xmlFormData#" overwrite="yes"/>

Done populating PDF form.


readXmlFilledForm.cfm

<cfpdfform  action="read"  source="#expandpath('1342NSfilled.pdf')#" result="test" />
    <cfdump var = "#test#" />

 
Result after running readXmlFilledForm.cfm

BKBK_0-1729026967126.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2024 Oct 15, 2024

Copy link to clipboard

Copied

My system:

  • Windows 10 Pro with latest updates.
  • Coldfusion 2023 Update 10.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2024 Oct 18, 2024

Copy link to clipboard

Copied

@sathiyanarayanan_7692 , did that help?

Did you manage to fill the form?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2024 Oct 18, 2024

Copy link to clipboard

Copied

Hi @BKBK  the read will give the struct , but the pdf is not filled in while viewing the pdf. when i preview  the filled pdf  it is  working, but when i download  the file it is working. there may ba any windows issues on our end. i'm still puzzled

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2024 Oct 18, 2024

Copy link to clipboard

Copied

i have downloaded the filled pdf in my local, VDI and even though my personal laptop all are not displaying the contents in pdf. any idea on this

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2024 Oct 18, 2024

Copy link to clipboard

Copied

Check your setup. As I said, It works on mine.

 

Verify the following, for example:

1.  Write-permissions for your/ColdFusion's account.

2.  Whether files are being cached.

 

I have renamed the files and tested the code again. It works as expected.

 

Steps:

1.  Save the code as fillFormWithXML.cfm and store in the same directory as prefilled1342NS.pdf.

2. When you launch the page  fillFormWithXML.cfm, the new form, XMLFilled1342NS.pdf, is created within the same directory. It is filled.  

 

<!--- Specify the XML file to populate the PDF form. ---> 
<cfset formdata='<?xml version="1.0" encoding="UTF-8"?>
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">  
	<xfa:data> 
		<form1>        
	        <ordDate>10/02/2024</ordDate>
	        <ordReqFillDate>11/02/2024</ordReqFillDate>
	        <ordCost_Ctr>999999</ordCost_Ctr>
	        <FlrUnit>Acute 9 East</FlrUnit>
	        <ordFilledBy></ordFilledBy>
	        <ordCheckedBy></ordCheckedBy>
	        <Misc1>Cocoa mix, 50 pkt per box</Misc1>
	        <MiscAmt1>10</MiscAmt1>
	        <Misc2>Coffee Creamer 12 oz</Misc2>
	        <MiscAmt2>20</MiscAmt2>
	        <ordby>Manimaran, Sathiyanarayanan</ordby>
        </form1>
    </xfa:data>	
</xfa:datasets>'/>
	
<cfset xmlFormData=xmlParse(formdata)> 

<cfpdfform source="#expandpath('prefilled1342NS.pdf')#" 
destination="#expandpath('XMLFilled1342NS.pdf')#" action="populate" XMLdata="#xmlparse(formdata)#" overwrite="yes"/>

Done populating form.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2024 Oct 18, 2024

Copy link to clipboard

Copied

Hi @BKBK  i just downloaded the file you have attached in the previous comment, it is showing empty. but the same file displayed on the preview. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2024 Oct 18, 2024

Copy link to clipboard

Copied

i tried the same thing in my personal laptop, the downloaded file from your previous comment is not displaying the content from the xml data. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 18, 2024 Oct 18, 2024

Copy link to clipboard

Copied

LATEST

As I said, check your system. The two PDFs are there on the Adobe site for anyone to see. 

 

One PDF has data from the XML, the other hasn't. Here are the printscreens of the displays on the Adobe ColdFusion forum site:

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2024 Oct 04, 2024

Copy link to clipboard

Copied

It seems you think "coldfusion is broken", and whether on update 8 or 10. Is that right? Since we three (Dave, BKBK, and I) have not heard of this issue before (and we're helping people here every day), that really puts the onus on you to demonstrate that the issue is not on your end.

 

Bkbk asked below for you code. I'd go further and ask you to please offer simple stand-alone demo code (perhaps even just a single line of code) along with a pdf that reflects your concern.

 

That would have two benefits. First, it would allow any of us to confirm your concern. Second, it might even help you to see that the problem is on your end.

 

In other words, if such simple demo code and pdf would work for you, then it would help you see that the issue is NOT with CF itself but instead with your FAILING pdf or code. You could study the differences. On the other hand, if such demo code did NOT work for you but DID work for us, then that would show that there was some environmental issue on your end.

 

I'm not saying whether there IS an issue on your end, nor am I saying there ISN'T an issue with CF. But I'm saying you can help prove things either way, by creating a simple standalone demo you can share with us. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation