Copy link to clipboard
Copied
I have hundreds of these labels in my folder. All labels are unique.
All labels are present in PDF format.
Label Detail:
Label Size : 6 X 4 Inch
Paper Size: A4 Standard
I want to create an action by which I can set 4 Labels (6 X 4 Inches) on 1 A4 paper sheet.
I would appreciate it if anyone could help me out.
What you should end up with after the previous two workflows:
All labels in sets of 4 in a single PSD file.
All invoices in sets of 4 in a single PSD file.
An extra step would be required to combine the matching sets of label and invoice files into a single 2 page PDF.
Info on saving and running scripts here:
Copy link to clipboard
Copied
Four different labels on one image?
Copy link to clipboard
Copied
Yes Stephen, you got it right.
Copy link to clipboard
Copied
My best advice would be to use PDF imposition software. Next would be a script for InDesign or Illustrator. This would retain text and vectors and produce smaller files.
My last choice would be Photoshop, which would require a script, not an action.
The script can just load up 4 images at a time until the input folder has been completed. If you require a more structured sorting, the files would need a numeric or alphabetically suitable naming structure.
Can you provide a download link to say 8 labels?
What file format should the 4up labels be when saved? Does it matter which label order are in columns and which are in the rows?
Copy link to clipboard
Copied
First of all, sorry for my late response.
Copy link to clipboard
Copied
I have a Photoshop solution for you... I don't have the time or inclination to script this as a single process. So, it is not 100% automated, it is multi-step, leveraging various scripts and actions. It does work in batches per stage.
Stage 1: Batch Rasterize the Acrobat PDF files
Run Paul Riggott's PDF Processor Pro II script, similar to the screenshot below:
This will need to be run once for the upper left label (UL Crop) and once for the upper right invoice (UR Crop). The action set has two actions to achieve the desired crop.
Here is the link to the "A5 Crop" action:
Here is a screenshot of the action steps.
Copy link to clipboard
Copied
Stage 2 of 2: Run a Script to Stack Into Sets of 4 and Create a 2x2 Layout
The following script will stack into sets of 4, it then uses another action to create a 2x2 pattern.
/*
Stack N Number of Docs to Layers.jsx
Stephen Marsh
20th August 2021 Version
A generic, skeleton "framework" script to help fast-track development of similar scripts for combining multiple
"sequence" single-layer files to layers.
This script requires input files from a single folder to be alpha/numeric sorting in order to stack in the correct
set quantity.
Example: File-01.jpg File-02.jpg etc, FileA1.tif FileA2.tif etc, File1a.tif File1b.tif etc.
A minimum of 2 or more files per stack is required. The quantity of input files must be evenly divisible by the stack quantity.
A named action set and action can be set on line 135 to "do something" with the stacked layers.
*/
#target photoshop
// app.documents.length === 0
if (!app.documents.length) {
try {
// Save and disable dialogs
var restoreDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
// Main script function
(function () {
// Select the input folder
var inputFolder = Folder.selectDialog('Please select the folder with files to process');
if (inputFolder === null) return;
// Limit the file format input, add or remove as required
var fileList = inputFolder.getFiles(/\.(png|jpg|jpeg|tif|tiff|psd|psb)$/i);
// Force alpha-numeric list sort
// Use .reverse() for the first filename in the merged file
// Remove .reverse() for the last filename in the merged file
fileList.sort().reverse();
//////////////////////////// Static Set Quantity - No GUI ////////////////////////////
var setQty = 4;
//////////////////////////////////////////////////////////////////////////////////////
// or...
//////////////////////////// Variable Set Quantity - GUI /////////////////////////////
/*
// Loop the input prompt until a number is entered
var origInput;
while (isNaN(origInput = prompt('No. of files per set (minimum 2):', '2')));
// Test if cancel returns null, then terminate the script
if (origInput === null) {
alert('Script cancelled!');
return
}
// Test if an empty string is returned, then terminate the script
if (origInput === '') {
alert('A value was not entered, script cancelled!');
return
}
// Test if a value less than 2 is returned, then terminate the script
if (origInput < 2) {
alert('A value less than 2 was entered, script cancelled!');
return
}
// Convert decimal input to integer
var setQty = parseInt(origInput);
*/
//////////////////////////////////////////////////////////////////////////////////////
// Validate that the file list is not empty
var inputCount = fileList.length;
var cancelScript1 = (inputCount === 0);
if (cancelScript1 === true) {
alert('Zero input files found, script cancelled!');
return;
}
// Validate the input count vs. output count - Thanks to Kukurykus for the advice to test using % modulus
var cancelScript2 = !(inputCount % setQty);
alert(inputCount + ' input files stacked into sets of ' + setQty + ' will produce ' + inputCount / setQty + ' output files.');
// Test if false, then terminate the script
if (cancelScript2 === false) {
alert('Script cancelled as the quantity of input files are not evenly divisible by the set quantity.');
return;
}
// Select the output folder
var outputFolder = Folder.selectDialog("Please select the folder to save to");
if (outputFolder === null) {
alert('Script cancelled!');
return;
}
// or
/*
// Create the output sub-directory
var outputFolder = Folder(decodeURI(inputFolder + '/Output Sets Folder'));
if (!outputFolder.exists) outputFolder.create();
*/
// Loop through and open the file sets
while (fileList.length) {
// Sets of N quantity files
for (var a = 0; a < setQty; a++) {
try {
app.open(fileList.pop());
} catch (e) { }
}
// Set the base doc layer name
app.activeDocument = documents[0];
docNameToLayerName();
// Stack all open docs to the base doc
while (app.documents.length > 1) {
app.activeDocument = documents[1];
docNameToLayerName();
app.activeDocument.activeLayer.duplicate(documents[0]);
app.activeDocument = documents[0];
// Do something to the stacked active layer (blend mode, opacity etc)
// app.activeDocument.activeLayer.blendMode = BlendMode.MULTIPLY;
app.documents[1].close(SaveOptions.DONOTSAVECHANGES);
}
////////////////////////////////// Start doing stuff //////////////////////////////////
app.doAction("Run", "2 x 2 A4 Layout");
////////////////////////////////// Finish doing stuff //////////////////////////////////
// Delete XMP metadata to reduce final file size of output files
removeXMP();
// Save name + suffix & save path
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var saveFile = File(outputFolder + '/' + Name + '_x' + setQty + '-Sets' + '.psd');
// var saveFile = File(outputFolder + '/' + Name + '_x' + setQty + '-Sets' + '.jpg');
// Call the save function
savePSD(saveFile);
//saveTIFF(saveFile);
//saveJPEG(saveFile);
//savePNG(saveFile);
// Close all open files without saving
while (app.documents.length) {
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
// Functions
function savePSD(saveFile) {
psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true;
psdSaveOptions.layers = false; // true for layers
psdSaveOptions.annotations = true;
psdSaveOptions.spotColors = true;
// Save as
app.activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);
}
/* Not currently used, a placeholder to swap in/out as needed
function saveTIFF(saveFile) {
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.byteOrder = ByteOrder.IBM;
tiffSaveOptions.transparency = true;
// Change layers to false to save without layers
tiffSaveOptions.layers = true;
tiffSaveOptions.layerCompression = LayerCompression.ZIP;
tiffSaveOptions.interleaveChannels = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.annotations = true;
tiffSaveOptions.spotColors = true;
tiffSaveOptions.saveImagePyramid = false;
// Image compression = NONE | JPEG | TIFFLZW | TIFFZIP
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
// Save as
app.activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
}
*/
/* Not currently used, a placeholder to swap in/out as needed
function saveJPEG(saveFile) {
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 10;
// Save as
activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
}
*/
/* Not currently used, a placeholder to swap in/out as needed
function savePNG(saveFile) {
var pngOptions = new PNGSaveOptions();
pngOptions.compression = 0; // 0-9
pngOptions.interlaced = false;
// Save as
app.activeDocument.saveAs(saveFile, pngOptions, true, Extension.LOWERCASE);
}
*/
function docNameToLayerName() {
var layerName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
app.activeDocument.activeLayer.name = layerName;
}
function removeXMP() {
if (!documents.length) return;
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
XMPUtils.removeProperties(xmp, "", "", XMPConst.REMOVE_ALL_PROPERTIES);
app.activeDocument.xmpMetadata.rawData = xmp.serialize();
}
}
// Restore saved dialogs
app.displayDialogs = restoreDialogMode;
// End of script notification
app.beep();
// Ensure that the following file format filter matches the save format
// .getFiles(/\.(tif|tiff)$/i);
var outputList = outputFolder.getFiles(/\.(psd)$/i);
// var outputList = outputFolder.getFiles(/\.(jpg|jpeg)$/i);
alert('Script completed!' + '\n' + outputList.length + ' combined files saved to:' + '\n' + outputFolder.fsName);
// Open the output folder in the Finder or Explorer
// outputFolder.execute();
}());
} catch (e) {
// Restore saved dialogs
app.displayDialogs = restoreDialogMode;
alert("If you see this message, something went wrong!");
}
}
else {
alert('Stack "N" Number of Sets:' + '\n' + 'Please close all open documents before running this script!');
}
Here is the action utilised by the script:
Copy link to clipboard
Copied
What you should end up with after the previous two workflows:
All labels in sets of 4 in a single PSD file.
All invoices in sets of 4 in a single PSD file.
An extra step would be required to combine the matching sets of label and invoice files into a single 2 page PDF.
Info on saving and running scripts here:
Copy link to clipboard
Copied
Thanks @Stephen_A_Marsh ,
These workflows work well.
If I have to tweak the position of the labels, then I have to edit the action. Right?
How could I make it a single workflow? any suggestions.....
Copy link to clipboard
Copied
The InDesign will place PDFs, so if your subscription includes InDesign the 2nd script I posted below should work without making the conversion to a bitmap file. If you want to print out of a different app the 4-up ID pages could be exported to PDF.
Copy link to clipboard
Copied
Thanks @Stephen_A_Marsh ,
These workflows work well.
If I have to tweak the position of the labels, then I have to edit the action. Right?
How could I make it a single workflow? any suggestions.....
By @radon5DF0
1. Yes, the action can be adjusted as required to alter the position of the labels.
2. You would need to learn how to script and do this yourself, or find somebody to do this for you as a free or paid service.
Copy link to clipboard
Copied
All labels are present in PDF format.
InDesign includes a catalog script, which might also work—you’ll find it in the Scripts panel’s Samples folder ImageCatalog.jsx. It will place images or PDFs in rows and columns using the default document setup. Dialog looks like this:
I’ve also written a variation, which lets you specify the page dimensions and margins, which might work better for an imposition. Dialog looks like this:
You can download my script here:
Copy link to clipboard
Copied
You state all your label files are in PDF format. Which PDF format? Acrobat PDF format or Photoshop PDF format. Acrobat PDF format file Open and Place in Photoshop through an Import dialog where you can select pages or or images etc. When a Photoshop PDF format file is open or is place in the are opened by Photoshop no import dialog is opened they are photoshop documents not the same as Acrobat PDF. If the label files are in Photoshop PDF format you can create and interactive action. Where the action would open your A4 template file that has four alpha channels the map the 4 label position on the A4 page. The action them uses an interactive open step for you select an label file. The action will then paste the label into the template close the table document and align the label to one of the four alpha channels. The move on to the next label. If all the lables are in a Foldet in the order toy want them populated. You could script thet process as a batch process noo interaction would be needed.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I feel you have a with problem with how you have your labels saved in Acrobat PDF files. If I open them in Photoshop as the PDF single Page. It opened as single Layer 0 A4 paper size at 300ppi. Or there are three images I can open as documents they open differently one an Amazon background layer not A4 size RGB color. The second one open index color that look like it may be a scanned signature. The third one opened as a layer 0 it contained a label 720ppi and not A4 size. . When I opened the PDF page it opens as a single Layer 0 A4 paper size 300 PPI . It is mostly transparent.with black dash line dividing the A4 size layer into forth. In the top let section there is a Label with a white background that fills most of that quarter in the top right quarter there is a label with a transparent background. The two bottom quarters are empty.
I feel you would have a difficult tine trying to script a Process to do what you want to do because of the way would need to Import the PDF file content and Isolate the content of the PDF you want and size them for your A4 template four areas.
Copy link to clipboard
Copied
An extra step would be required to combine the matching sets of label and invoice files into a single 2 page PDF.
Watch this space:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/tiff-to-pdf-converter/td-p/12540527