Hi,
I am making a script that takes objects from visible layers and scales them on a temporary layer 'temp' and then exports those scaled and grouped objects as a png.
There is only one problem, one object is a live paint and it is causing some problems. Everything looks perfect until You take a look at the exported png. The live paint object remains in original size in the export even though in illustrator it is scaled correctly with other objects.
But when I run the script secont time withouth the scale function it exports as it shoulds. Do you Guys have any idea?
var docRef = app.activeDocument;
var myDocumentsFolder = Folder.myDocuments;
var path1 = myDocumentsFolder;
function saveAsPNG(newPath,doc) {
var pngFile = new File(newPath + doc.name.split("_")[0]+".png" );
var resolution = 72;
var opts = new ImageCaptureOptions();
opts.resolution = resolution;
opts.antiAliasing = true;
opts.transparency = false;
try {
doc.imageCapture(pngFile, doc.geometricBounds, opts);
} catch (e) {
}
}
function scale(docRef)
{
docRef.layers.add().name = "temp";
docRef.selectObjectsOnActiveArtboard();
app.executeMenuCommand("copy");
docRef.layers.getByName("temp");
app.executeMenuCommand("pasteInPlace");
app.executeMenuCommand("group");
var selected = app.selection[0];
var layer = docRef.layers.getByName("temp");
selected.move(layer,ElementPlacement.PLACEATBEGINNING);
selected.resize(200, 200, true, true, true, true, 200);
//docRef.layers.getByName("temp").remove
}
scale(docRef);
alert("about to export");
app.doScript
saveAsPNG(path1, docRef);

