Copy link to clipboard
Copied
We are using several single user licenses in the company. Those colleagues shall be able to apply stationery to pdf files via an action.
I have created an action which sets this background file. That file is in the same folder as the future merge files, like this:
folder - D:\Templates\Offers
background file - background.pdf
file to be merged - offer_12345.pdf
the exported action - our-stationery.sequ
Now when the action is imported by a colleague, the background.pdf will not be found, even though it's located in the same folder.
Let's have a look into the .sequ file (xml):
<Command name="COMP:AddBackground" pauseBefore="false" promptUser="false">
<Items>
<Items name="WaterBackCmd">
<Item name="ANNOT" type="boolean" value="false"/>
<Item name="BACKGROUND" type="boolean" value="true"/>
[…]
<Item name="WATERMARK" type="boolean" value="false"/>
</Items>
<Item name="WaterBackCmd_SRC_FILE" type="text" value="Rb-Kopfbogen_Folgeseite.pdf"/>
<Item name="WaterBackCmd_SRC_PARENT" type="text" value="/D/Templates/Offers/"/>
</Items>
</Command>
Of course. If my colleague is using a folder C:\Offers, this cannot work.
I have tried to manually empty the WaterBackCmd_SRC_PARTENT value, but that breaks the imported action.
What are the allowed values for the folder?
I cannot believe that there shouldn't be something like "self" or at least a relative path. What sense would it make to export an action if it ist not suitable for collaboration, then?
Copy link to clipboard
Copied
Do NOT edit the SEQU file directly, unless you really know what you're doing. I recommend you delete that Action and create a new one.
The only thing you need to do is add an Execute JavaScript command with the code I provided, and a Save command.
Adding two backgrounds is a bit trickier, as they can conflict. You can try this code:
this.addWatermarkFromFile({cDIPath: this.path.replace(this.documentFileName, "background-first.pdf"), nStart: 0});
this.addWatermarkFromFile({cDIPath: this.path.replace(this.documentFileName, "background.pdf"), nStart: 1, nEnd: this.numPages-1});
Copy link to clipboard
Copied
It is possible to do it, but it requires using a script.
The basic command would be:
this.addWatermarkFromFile({cDIPath: this.path.replace(this.documentFileName, "background.pdf")});
There are a lot of other parameters that can be set, but you'll need to specify how you want the background to look like first...
Copy link to clipboard
Copied
Good hint, thanks.
Tested (to simulate collaboration):
Result: the javascript makes no difference, the action is still prompting for file.
Actually I left out an important feature (hoping not to make it too complicated):
In fact we need to merge 2 backgrounds.
Now with the javascript in the action, what happens is that it merges both! backgrounds with all the pages.
Copy link to clipboard
Copied
Do NOT edit the SEQU file directly, unless you really know what you're doing. I recommend you delete that Action and create a new one.
The only thing you need to do is add an Execute JavaScript command with the code I provided, and a Save command.
Adding two backgrounds is a bit trickier, as they can conflict. You can try this code:
this.addWatermarkFromFile({cDIPath: this.path.replace(this.documentFileName, "background-first.pdf"), nStart: 0});
this.addWatermarkFromFile({cDIPath: this.path.replace(this.documentFileName, "background.pdf"), nStart: 1, nEnd: this.numPages-1});
Copy link to clipboard
Copied
Ah, great, thank you so much!
Lesson learned: not getting seduced by clickable action items, focus on JavaScript right away.
Copy link to clipboard
Copied
JS can do a lot of things that the built-in commands can't, and is more flexible in doing so, but the reverse is also true. The trick is to select the right kind of command for the task... But that is something you learn the more you do it. There's no clear guide on what's the best command to use, because it depends a lot on what you want to achieve.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now