Copy link to clipboard
Copied
Hi All,
I am new to the environment, My requirement We created some custom fields for pdf document and we created a pdf form as well. Now our requirement is what data is available in Custom Properties it has to auto fill in the pdf form. I heard we can achive using javascript. Could someone please help me on this.
Copy link to clipboard
Copied
HI,
Are you wanting to copy some of the data from the document information to some fields on the document?
Regards
Malcolm
Copy link to clipboard
Copied
Thank you So much for your response. Yes you are I want to copy from custom Properties to the form fields inside the document.
Kindly help me as it is urgent for my use case. let me know if you need any additional information.
Thanks,
Naveen.
Copy link to clipboard
Copied
The Acrobat JavaScript reference includes information about document info fields: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_Acro...
Copy link to clipboard
Copied
Hi johnson,
Thank you so much, is it same for Custom Properties as well or anything else we need to follow
regards
Naveen
Copy link to clipboard
Copied
It should work. Here's a code sample the gets the value from a custom info field and populates a text field:
getField("Text1").value = info["My Custom Info Field"];
where "My Custom Info Field" is the name of the info field you want to use.
Copy link to clipboard
Copied
Hi Johnson,
Thank you so much for the detailed information. I have tried the above code my not getting the results I have attached the screenshot of my Javascript code, form fields, and custom properties. Kindly let me know where my I am doing wrong.
Copy link to clipboard
Copied
It's not clear to me if the project number field name is what you used, or if you actually called the test function. Also, "Name" is not one of the custom fields that you've set up, so you should try "SourceModified", "Company", or "Comments" instead.
Copy link to clipboard
Copied
Hi Johnson,
Yes I am using Project Number field. I tried changing to SourceModified. but still it is not coming.
Copy link to clipboard
Copied
It might be easiest if you could post a sample document.
Copy link to clipboard
Copied
it is the sample code:
function test()
{
getField("Project No:").value = info["SourceModified"];
}
Copy link to clipboard
Copied
This defines a function. Where does you run/execute the function?
Copy link to clipboard
Copied
I am not sure where exactly I have to keep. Now I am calling like this.
Copy link to clipboard
Copied
It might be best to review your requirements. I understand you want to fill a form field with the same information that's in a custom info field. What's not clear is when this needs to be done. How is the custom info added to the document in the first place? When are the form fields added, and is it an automated process of a manual one? It seems like you'd only need to run the script once, before the document is made available for others to use, is that right?
Copy link to clipboard
Copied
Hi Johnson/Bernd,
Could you please help me on this.
Thanks,
Naveen.
Copy link to clipboard
Copied
Check the console for errors.
Copy link to clipboard
Copied
Hi,
Are you able to share a sample document that we could use to show how to solve the problem?
Your are trying to get a field called "Project No:", that is the text that appears on the form, but is it actually the name of the field?
As you are running on the DocumentClose event, I am not sure if this would be saved, could you move it to a button or something on the form, for the sake of easier testing, and making sure the code is working as expected.
Regards
Malcolm
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Could you please help me on this?
Copy link to clipboard
Copied
Hi,
I am not sure that any change made on the Will Close event would not be saved as the Save is probably already done.
Can you post a sample document that we can investigate?
Regards
Malcolm
Copy link to clipboard
Copied
Hi Barlae/Johnson,
Kindly let me know your availability please let me I will connect with you for 5 mints.
Thanks,
Naveen.
Copy link to clipboard
Copied
HI,
I am around most days, feel free to email "info @ barlaedc .co .uk" (without spaces) if you want to take this conversation off the forums.
Regards
Malcolm
Copy link to clipboard
Copied
Hi Barlae,
I send you an email could you please check once and let me know you inputs.
Thanks,
Naveen.
Copy link to clipboard
Copied
Hi Barle,
Could you please check my mail and let me know. It is little urgent.
Thanks,
Naveen.
Copy link to clipboard
Copied
Hi Naveen,
I have uploaded a document to this folder - https://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fPhttps://adobe.ly/2Vaq4fP https://adobe.ly/2Vaq4fP in the folder called "InfoToField", this should how the field could be populated by the document information field called Keywords, on document open.
you can see the script by searching for the word "JavaScript" and open the document JavaScripts. this code also has console outputs so that you can see if it working by looking in the console.
Regards
Malcolm