Creating a submit button that will rename, flatten, hide button, save a copy, and email new file.

Explorer ,
Feb 16, 2019

Copy link to clipboard

Copied

I am setting up a fillable form using Acrobat DC. It is intended to be a quick and easy way of creating invoices to customers.

There are fields for FirstName, LastName, Address1, Address2, PostCode, TelephoneNumber, Email, InvoiceNumber, ItemDescription, ItemCost, Total.

I have created a submit button for the form. When I click it, it currently opens my mail client, fills the Subject field with a specified text, creates body text, including taking the recipient's first name from the form as a greeting, then sends a copy of the pdf to my email address, and to the recipient's email address, again, taken from a field on the form.

That's all working well. I want it to do more though.

This is the workflow I would like:

Click Submit > OnMouseUp > Hide the submit button > Flatten the entire file so that it is no longer editable, Create a new PDF file from the original pdf, naming it with input from the InvoiceNumber field on the original > Save the new file to the same folder as the original (with its new name) > email the flattened and renamed file to a specified email address, as well as to the email address taken from the original form, and populate the subject and body of the email based on strings and field forms > Then finally to restore the original to editable status, and Unhide the Submit button, ready to use again.

I realise this is asking a lot on one click, but is there a way to achieve all this using javascript?

(Please bear in mind I am not a coder, and will need talking to as if I know nothing. Assuming zero knowledge won’t be far off  he mark!)

Thanks so much for any help you can provide.

Nathan

Thanks so much for your responses and the offer of a custom solution. It’s taken me a lot of effort, as two weeks ago, I had zero knowledge of javascript and had never used acrobat. As of yesterday afternoon, I now have a form that does all I wanted it to and more. (validating field formats, highlighting errors in different colours, replacing default text on click and outputting final text to various styles onclick, nesting drop downs that show/hide other field on selection, there’s a reset form button that not only clears the fields of inputted data, but also resets the default text colour/font/styles that changed while the firm was being filled out, but also hides/shows any fields that have had their .display settings changed since onload.  And finally, the grand finale, where a custom menu item hides all unused fields, hide the reset button, styles the text in a certain way, saves the doc to a specified location, using field data as the new file name, flattens the new doc, builds an email that will send to ab address from the form, pulls other data from specific fields to populate the subject and body of the email and make it personal and specific to the recipient, then finally closes the original document, leaving it untouched and ready to use next time.)

I have to say, I may not have slept much over the past few days, and I may have spent a total of a few hours screaming at my computer in frustration, but I am more than a little proud of my new invoice-creating machine, and overjoyed that I have learnt so much along the way.

So to anyone reading this, who might be struggling, and thinking that scripting in acrobat is an impenetrable maze: it’s not. You CAN make it work. Just keep searching these forums for other people’s exoeeiences and knowledge, and don’t give up!

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

691

Likes

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

Creating a submit button that will rename, flatten, hide button, save a copy, and email new file.

Explorer ,
Feb 16, 2019

Copy link to clipboard

Copied

I am setting up a fillable form using Acrobat DC. It is intended to be a quick and easy way of creating invoices to customers.

There are fields for FirstName, LastName, Address1, Address2, PostCode, TelephoneNumber, Email, InvoiceNumber, ItemDescription, ItemCost, Total.

I have created a submit button for the form. When I click it, it currently opens my mail client, fills the Subject field with a specified text, creates body text, including taking the recipient's first name from the form as a greeting, then sends a copy of the pdf to my email address, and to the recipient's email address, again, taken from a field on the form.

That's all working well. I want it to do more though.

This is the workflow I would like:

Click Submit > OnMouseUp > Hide the submit button > Flatten the entire file so that it is no longer editable, Create a new PDF file from the original pdf, naming it with input from the InvoiceNumber field on the original > Save the new file to the same folder as the original (with its new name) > email the flattened and renamed file to a specified email address, as well as to the email address taken from the original form, and populate the subject and body of the email based on strings and field forms > Then finally to restore the original to editable status, and Unhide the Submit button, ready to use again.

I realise this is asking a lot on one click, but is there a way to achieve all this using javascript?

(Please bear in mind I am not a coder, and will need talking to as if I know nothing. Assuming zero knowledge won’t be far off  he mark!)

Thanks so much for any help you can provide.

Nathan

Thanks so much for your responses and the offer of a custom solution. It’s taken me a lot of effort, as two weeks ago, I had zero knowledge of javascript and had never used acrobat. As of yesterday afternoon, I now have a form that does all I wanted it to and more. (validating field formats, highlighting errors in different colours, replacing default text on click and outputting final text to various styles onclick, nesting drop downs that show/hide other field on selection, there’s a reset form button that not only clears the fields of inputted data, but also resets the default text colour/font/styles that changed while the firm was being filled out, but also hides/shows any fields that have had their .display settings changed since onload.  And finally, the grand finale, where a custom menu item hides all unused fields, hide the reset button, styles the text in a certain way, saves the doc to a specified location, using field data as the new file name, flattens the new doc, builds an email that will send to ab address from the form, pulls other data from specific fields to populate the subject and body of the email and make it personal and specific to the recipient, then finally closes the original document, leaving it untouched and ready to use next time.)

I have to say, I may not have slept much over the past few days, and I may have spent a total of a few hours screaming at my computer in frustration, but I am more than a little proud of my new invoice-creating machine, and overjoyed that I have learnt so much along the way.

So to anyone reading this, who might be struggling, and thinking that scripting in acrobat is an impenetrable maze: it’s not. You CAN make it work. Just keep searching these forums for other people’s exoeeiences and knowledge, and don’t give up!

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

692

Likes

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
Feb 16, 2019 0
Adobe Community Professional ,
Feb 16, 2019

Copy link to clipboard

Copied

First, use a larger font.  You're post is hard to read.

Next, Yes, all this can be done with JavaScript, but not as a form script. It has to be done as a folder level automation script, and it will only work on Acrobat Pro/Standard. Any system on which this process is required will require installation of the automation script.

You can read more about automation in these tutorials:

Automating Acrobat can save you loads of time.

https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

Contact me if you are interested in custom development.

Likes

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
Reply
Loading...
Feb 16, 2019 0
Explorer ,
Feb 16, 2019

Copy link to clipboard

Copied

Hi Thom, firstly, my apologies for the small font thing: not knowing how these forums worked (first-time poster, and green as all anything!), I had prepared the question in another programme, and copied it and pasted it into the text box on here. I didn’t realise it would bring the formatting with it!

Thanks so much for these resources. I will need to learn about how to set up folder-level automation scripts and then I’ll sit down and digest what you’ve pointed me towards. Hopefully I’ll be able to work out what I need to do without too much trouble, even if I don’t necessarily come up with the most elegant solution—as long as it works!

If I get stuck, I may come back to you for a custom solution. (I say that with absolutely no idea what would be an appropriate fee for such work, so it may not be something I can pursue in that respect, but it’s great to know that you are there as an expert fallback, should I decide my head is too full of other stuff to allow this new stuff to make any sense to me!

Thanks so much for your response. I really appreciate you taking the time.

Best wishes,

Nathan

Likes

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
Reply
Loading...
Feb 16, 2019 0
Explorer ,
Feb 17, 2019

Copy link to clipboard

Copied

Hello Thom, It turns out that I AM interested in a custom solution for my original post, and I was wondering if you would be happy to give me a quote for the job?

Likes

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
Reply
Loading...
Feb 17, 2019 0
Adobe Community Professional ,
Feb 17, 2019

Copy link to clipboard

Copied

Hello Nathang,

  I'd be happy to provide you with a solution. Please contact me at support@windjack.com, and we can setup a meeting.

-Thom

Likes

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
Reply
Loading...
Feb 17, 2019 0
Explorer ,
Mar 07, 2019

Copy link to clipboard

Copied

Thanks so much for your responses and the offer of a custom solution. It’s taken me a lot of effort, as two weeks ago, I had zero knowledge of javascript and had never used acrobat. As of yesterday afternoon, I now have a form that does all I wanted it to and more. (validating field formats, highlighting errors in different colours, replacing default text on click and outputting final text to various styles onclick, nesting drop downs that show/hide other field on selection, there’s a reset form button that not only clears the fields of inputted data, but also resets the default text colour/font/styles that changed while the firm was being filled out, but also hides/shows any fields that have had their .display settings changed since onload.  And finally, the grand finale, where a custom menu item hides all unused fields, hide the reset button, styles the text in a certain way, saves the doc to a specified location, using field data as the new file name, flattens the new doc, builds an email that will send to ab address from the form, pulls other data from specific fields to populate the subject and body of the email and make it personal and specific to the recipient, then finally closes the original document, leaving it untouched and ready to use next time.)

I have to say, I may not have slept much over the past few days, and I may have spent a total of a few hours screaming at my computer in frustration, but I am more than a little proud of my new invoice-creating machine, and overjoyed that I have learnt so much along the way.

So to anyone reading this, who might be struggling, and thinking that scripting in acrobat is an impenetrable maze: it’s not. You CAN make it work. Just keep searching these forums for other people’s exoeeiences and knowledge, and don’t give up!

Likes

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
Reply
Loading...
Mar 07, 2019 2