Export all layer comps to PDF using a layer as a crop area

Tags: Photoshop, ExtendScript, layer comp, export, PDF

Categories: Photoshop

Because most Photoshop designs or specifically the layer comps within those designs tend not to fill the entire canvas you normally end up manually cropping whatever format you export. So I extended on of the layer comp export scripts to do a crop as well. I'm export to PDF but I'm sure you could add the lines below to crop the image exports too.


var cropBounds = duppedDocument.artLayers.getByName('ExportCropSize').bounds;
duppedDocument.crop(cropBounds);

The first line get the outer bounds or a layer called 'ExportCropSize' and the second line does the crop. A nice extension to this would be to get the reference to the layer that denotes the crop size from the name of the layer comp. So a layer comp called 'LayerCompOne_CROP-DefaultCropSize-CROP' would use a layer called 'DefaultCropSize' for the crop size. It's too much for my needs at the moment as I only need to crop to a single size per PSD.

11 Comments

Add a Comment