booder101
10-08-2009, 03:51 PM
Hello, I think this there is a simple solution, I just cannot find it. I want to export a layer of Illustrator with a white background. I am able to export the layer, but it has a transparent background. I got the basic code off the internet and just changed options.transparency = false but this does not do the trick. Greatly appreciate any help - I have looked thru Javascript/actionscript reference guides searching for setting background to white but have not had luck.. Thank you!
=-======================
script follows:
/**
* @author Niels Bosma ([email protected]
*/
var folder = Folder.selectDialog();
var document = app.activeDocument;
if(document && folder)
{
var options = new ExportOptionsPNG24();
options.antiAliasing = true;
options.transparency = false;
var n = document.layers.length;
for(var i=0; i<n; ++i)
{
hideAllLayers();
var layer = document.layers[i];
layer.visible = true;
var file = new File(folder.fsName+"/"+layer.name+".png");
var options = new ExportOptionsPNG24();
options.artBoardClipping = true;
document.exportFile(file,ExportType.PNG24,options) ;
}
showAllLayers();
}
function hideAllLayers()
{
forEach(document.layers, function(layer) {
layer.visible = false;
});
}
function showAllLayers()
{
forEach(document.layers, function(layer) {
layer.visible = true;
});
}
function forEach(collection, fn)
{
var n = collection.length;
for(var i=0; i<n; ++i)
{
fn(collection[i]);
}
}
=-======================
script follows:
/**
* @author Niels Bosma ([email protected]
*/
var folder = Folder.selectDialog();
var document = app.activeDocument;
if(document && folder)
{
var options = new ExportOptionsPNG24();
options.antiAliasing = true;
options.transparency = false;
var n = document.layers.length;
for(var i=0; i<n; ++i)
{
hideAllLayers();
var layer = document.layers[i];
layer.visible = true;
var file = new File(folder.fsName+"/"+layer.name+".png");
var options = new ExportOptionsPNG24();
options.artBoardClipping = true;
document.exportFile(file,ExportType.PNG24,options) ;
}
showAllLayers();
}
function hideAllLayers()
{
forEach(document.layers, function(layer) {
layer.visible = false;
});
}
function showAllLayers()
{
forEach(document.layers, function(layer) {
layer.visible = true;
});
}
function forEach(collection, fn)
{
var n = collection.length;
for(var i=0; i<n; ++i)
{
fn(collection[i]);
}
}