Hi all
First post and first script ![]()
Im trying to add a pdf on top of an existing PDF in illustrator using a script. This is supposed to be done by anyone at my firm so that is why I want it in a script. I also have a lot of other functions that works that will do some other stuff with this document.
Created this from the scripting guide but it doesnt work. Im pretty sure its the embedDoc var thats empty and i dont understand why.
Im not sure if the File "points" to the directory of the script or the original file but Ive tried both ofcoarse.
This is the masterpiece
var embedDoc = new File("/temp/testfile1.pdf");
if ( app.documents.length > 0 && embedDoc.exists ) {
var doc = app.activeDocument;
var placed = doc.groupItems.createFromFile( embedDoc );
}else {alert("suck")}
//Marcus
/ always starts at the root of your current drive. What *that* means depends on your OS!
You'd get the path from your current file by something like
currPath = app.activeDocument.path;
.. then you can add your temp folder with
embedDoc = new File(currPath+'/temp/testfile.pdf");
.. but *only* if that sub-folder actually exists in the path you stored the file in. The actual code depends entirely on your workflow, I guess.
North America
Europe, Middle East and Africa
Asia Pacific