Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Script for placing filename inside files on the bottom - not working

$
0
0

Hello

 

we are working right now on about 1500 files and the client ask us to place on each file

the filename without an extension on the lower left corner in 26pt in a specific type. I can

already loop through the files inside a folder and place the filename, but it also creates

a clipping path and the textframe is placed on the top left corner in 12pt.

 

 

any Idea what I do wrong here? Files are about 250 cm high - the lengths are different and

it should be saved as a CMYK PDF

 

Thanks

 

 

 

 

 

var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pdfSaveOpts;


// Select the source folder.
sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator .ai files you want to convert to PDF');


// If a valid folder is selected
if ( sourceFolder != null )
{
    files = new Array();    fileType = "*.pdf"; //prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' );    // Get all files matching the pattern    files = sourceFolder.getFiles( fileType );    if ( files.length > 0 )    {        // Get the destination to save the files        //destFolder = Folder.selectDialog( 'Select the folder where you want to save the converted PDF files.', '~' );        destFolder = sourceFolder;        for ( i = 0; i < files.length; i++ )        {            sourceDoc = app.open(files[i]); // returns the document object                       with(sourceDoc) {            var pointTextRef = textFrames.add();  pointTextRef.contents = sourceDoc.name.replace(/\.[^\.]+$/, '');  pointTextRef.textRange.Size = 26;  pointTextRef.bottom = 0;  pointTextRef.left = 0;            }            targetFile = getNewName();            // Call function getPDFOptions get the PDFSaveOptions for the files            pdfSaveOpts = getPDFOptions();                      // Save as pdf            sourceDoc.saveAs( targetFile, pdfSaveOpts );            sourceDoc.close();        }        alert( 'Files are saved as PDF in ' + destFolder );    }    else    {        alert( 'No matching files found' );    }
}




function getNewName()
{
    var ext, docName, newName, saveInFile, docName;    docName = sourceDoc.name;    ext = '_export.pdf'; // new extension for pdf file    newName = "";    for ( var i = 0 ; docName[i] != "." ; i++ )    {        newName += docName[i];    }    newName += ext; // full pdf name of the file    // Create a file object to save the pdf    saveInFile = new File( destFolder + '/' + newName );    return saveInFile;
}


function placetype(){








}



function getPDFOptions()
{
    // Create the PDFSaveOptions object to set the PDF options    var pdfSaveOpts = new PDFSaveOptions();    // Setting PDFSaveOptions properties. Please see the JavaScript Reference    // for a description of these properties.    // Add more properties here if you like    pdfSaveOpts.acrobatLayers = false;    pdfSaveOpts.colorBars = false;    pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;    pdfSaveOpts.compressArt = true; //default    pdfSaveOpts.embedICCProfile = true;    pdfSaveOpts.enablePlainText = true;    pdfSaveOpts.generateThumbnails = true; // default    pdfSaveOpts.optimization = true;    pdfSaveOpts.pageInformation = false;    pdfSaveOpts.preserveEditability = false;    return pdfSaveOpts;
}

Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>