Skip to main content
Inspiring
December 5, 2017
Question

A script that places a company logo on an image?

  • December 5, 2017
  • 2 replies
  • 1578 views

I am looking for a script I can run that places my company's logo on the bottom left of the artboard in Illustrator.  The actual script doesn't have to be this specific; I can program some variation myself.  The script just has to take an object from a specific location/folder, place it in the same spot on the art board, and (ideally) embed the smart-object.

Any help would be awesome!

Thanks,

Mat

This topic has been closed for replies.

2 replies

JonathanArias
Legend
December 5, 2017

if you use master page in adobe indesign you an place the logo/ art one time on a master page and than just place your art in pages with the art always been in the same location. Thats if we are even talking about all of this documents having the same size.

Can you explain more on what you want to do?

Loic.Aigon
Legend
December 19, 2017

This should work given that you properly reference the logo file:

//Loïc Aigon - www.ozalto.com

//Main routine

var main = function() {

//VARS

var doc, abs, nAb, n, rect, placed, layers, logosLayer, abH;

//The reference to the local logo file

const logoFile = File ( Folder.desktop+"/logo.pdf" );

if ( !app.documents.length ) {

alert("This scripts needs an open document !");

return;

}

//Checking file before placement

if ( !logoFile.exists ) {

alert("The logo file couldn't be found at\r"+logoFile.fsName);

return;

}

doc = app.activeDocument;

//Creating a new "logos" layer

layers = getLayers(doc);

logosLayer = layers["logos"];

if ( logosLayer ) logosLayer.remove();

logosLayer = doc.layers.add();

logosLayer.name = "logos";

//Looping through artboards to add logo

abs = doc.artboards;

n = abs.length;

while ( n--) {

//processing nth artboard

nAb = abs;

rect = nAb.artboardRect;

abH = Math.abs ( rect[3]-rect[1] );

//Placing the file only once at first loop then duplicate instance after

if ( !placed ) {

placed = doc.placedItems.add();

placed.file = logoFile;

}

else {

placed = placed.duplicate();

}

//Setting logo properties

placed.layer = logosLayer;

placed.left = rect[0];

placed.top = rect[1]-abH+placed.height;

}

logosLayer.locked = true;

}

//Getting data on layers

function getLayers( doc ) {

var ls = doc.layers, n = ls.length, l, o = {}

while ( n-- ) {

l = ls;

o[l.name] = l;

}

return o;

}

//Running routine

main();

HTH

Ozalto | Productivity Oriented - Loïc Aigon

y.tani
Inspiring
January 11, 2018

Loic.Aigon

I have nothing to do with the questioner,

I was in trouble because I did not know how to place PDF,

I was saved by your post.

Doug A Roberts
Community Expert
Community Expert
December 5, 2017

what would it be placing this logo on? existing files or new files? are these artboards all the same size or different sizes? would it run on one file at a time or on a batch? would the batch be in a particular folder or be open documents?