Using the CopyContent script

One of the predefined Javascripts which come with Infigo Designer is the CopyContent script. This script allows you to automatically copy the content contained within one field to another field of the same type (image or text). 

Note: The content will be copied over upon the creation of the output and will not be visible in the editor.


For this example, I have set up a two-page PDF, each containing a single image field and a single text field.


I will be setting up the product to copy the contents of the fields on the first page, to the respective fields on the second page.

Firstly, navigate to Infigo Designer -> Predefined Javascripts as seen in the screenshot below.


This will open up a menu which lists all of the predefined Javascripts which come with Infigo Designer. From this menu, you will want to click on "CopyContent" and click "Run Script"


This will open another menu which will list all of the current instances of this script in this PDF, as well as allow you to make a new instance. As I have not created any instances of this before on my PDF, there is no list.


Here, you want to click "Add" which will open up a list of all the fields contained in the PDF. As you can see, all four fields are visible on this list. Firstly, I'm going to set it up so that the image field copies over. To do this, I'm going to highlight the "CopyImageFrom" field, then click "OK".


This redirects to a similar page, except as you can see, this is filtered to only show fields of the same type. In this instance, it is only showing the image field which is located on the second page. Here, I am going to select the field I want to copy the image to, which is the only choice in this instance, and once again, click "OK".


When I click "OK", I will likely be prompted with a box informing me that the target field is not fixed. The target field must be fixed as this will prevent the users from interacting with it in the editor and interfering with the script.


If I click "Yes" it will redirect me to the same box which opened up when I first ran the script, except as you can see, it has now populated with the script instance I have just configured.


Now I am going to follow the same steps, except selecting the appropriate text fields instead. As you can see in the screenshot below, this will add another instance to the dropdown list, showing that the script instance has been successfully set up.


Now, all that's needed is to save the PDF and upload it to my storefront.

As you can see in the below screenshots, I can interact with the fields on page 1, but cannot do so on page 2. This is because the fields on page 2 are set to be fixed.


Below is a screenshot of the simple modifications I have made to the first page. I simply added an image to the image field, and changed the text in the text field.


After placing the order and retrieving the output, I can see that the script has worked successfully and the fields have been copied over to create a perfect replica of their originals.


The download link for the PDF I created in this example can be found below, please feel free to use it as a reference for how the script looks in the PDF itself.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk