Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pdf_export [2018/02/20 05:16] – [2.1.0] o2adminpdf_export [2024/04/04 09:08] (current) – [Javascript] o2admin
Line 1: Line 1:
 +====== PDF Export ======
  
 +In a production environment, you want to quickly export PDF files of single artboards or entire documents without having your document renamed. This script lets you export to PDF using presets, and intelligently name the exported file using the original linked file name, the document color mode, the artboard name and the PDF preset name used and more.
  
 +==== PDF Options ====
 +
 +  *   **PDF Preset** - We recommend creating some custom PDF settings in Illustrator for your workflow, Such as a PDF setting dedicated for printing or proofing, you can set these in Illustrator in the  [EDIT > Adobe PDF Presets...] Menu
 +  *   **Run spell checking before creating PDF**- Better to be safe!
 +  *   **Preserve Illustrator Editing Capabilitie**s - If turned off, will reduce the size of the PDF 
 +  *  ** Secure with password** - Stops the PDF from being used and uses the password set in the Settings tab. //Note that passwords in PDF files are not 100% secure; there are online tools to bypass passwords. This should be considered a deterrent, such as hindering the printing of a low-resolution proof but not protecting the artwork from copying.//
 +  *   **Open PDF after export** - Opening the PDF in the computer's default reader after export
 +  *   **Open Folder after export** - Opens the destination in Windows Explorer or OSX Finder.
 +  * **Copy filenames to Clipboard after export** - Once the files as successfully exported copy the filenames to the clipboard, If you want to copy the full filename including path see the history below
 +
 +==== Artboard Range ====
 +
 +Select the pages to be exported.
 +
 +==== Additional Marks ====
 +
 +Add an additional confidence strip to check for consistent printing.
 +
 +The artwork scale setting only affects the scale of the marks, it does not scale the PDF file.
 +
 +==== Save To====
 +
 +Choose a Location where to save your PDF
 +
 +==== Javascript ====
 +
 +You can run Extendscript (Illustrator's built-in version of Javascript) to modify the file and path. Your code will be wrapped in a function, so ensure that you include a return statement with the required data structure.
 +
 +  * Return an array with the find and replace values such as [{ find: "ABC", replace: "123"},{find: "Cat", replace: "Dog"}], which will be applied to the filename template
 +  * Return false to cancel without error
 +  * Return string to show as an error.
 +
 +**Variables passed your code**
 +  * 'path' is the destination path.
 +  * 'filename' is the filename template.
 +  * 'index' is the current artboard index.
 +  * 'range' is the page range being used. i.e '2-4'
 +
 +**Functions**
 +  * Call getData(variable) to get the standard data from the table below, such as getData('doc.filename'
 +  * Call setPath(path) to change the destination path
 +  * Call setFilename(filename) to set the filename template (overwriting the existing filename template)
 +
 +Example
 +<sxh javascript; >
 +
 +// This example will extract the ID number from a filename and 
 +// save the  PDF to a master folder based on the ID in the X: drive
 +// "Example filename "Customer F123246 Test File.pdf"
 +
 +// Get the current document filename
 +var docName = getData('doc.filename');
 +
 +// Use a Regular Expression to get the ID
 +var matches = docName.match(/F(\d+)/);
 +if (matches) {
 +  setPath('X:/' + matches[1] + '/');
 +  return [];
 +}
 +
 +return 'Can not find a valid ID in the filename';
 +
 +
 +</sxh>
 +
 +==== Filename ====
 +
 +You can setup the filename template, and the values in the template will be replaced as the PDF file is exported.
 +
 +  * {doc.filename} - {artboard.name}.pdf
 +  * {doc.filename} - {artboard.name} - {doc.colorSpace} - [{pdf.preset}] - {artboard.number} of {artboard.count}.pdf
 +  * {doc.filename} - {artboard.name} - {artboard.number} of {artboard.count}.pdf
 +  * {doc.filename} - PROOF Ver{?Proof Version}.pdf** (This will ask for the version number)**
 +  * {doc.filename} - PAGE  {artboard.number} -  {artboard.width}x{artboard.height} {doc.rulerunits}.pdf
 +  * {doc.filename} - {export.number} of {export.count} PROOF.pdf
 +  * * Archive of {doc.filename} - [{weekday} {day}-{month}-{year}].pdf
 +
 +|**{Variable}**|**Description**|**Example Output*|
 +|timestamp|Timestamp| 2024-02-03 14:33:12|
 +|time|Time HH:MM:SS|14:33:12|
 +|weekday|Weekday|Monday|
 +|shortweekday|Short Weekday|Mon|
 +|day|Day|3|
 +|month|Month|7|
 +|year|Year|2024|
 +|linked.filename|Filename of First Linked File|*Empty if none found|
 +|pdf.preset|PDF Preset Name| |
 +|artboard.width|Artboard Width in document units | |
 +|artboard.height|Artboard Height in document units| |
 +|artboard.number|Artboard Page Number|  |
 +|artboard.name|The first Artboard Name in the range|  |
 +|artboard.count|Total Artboard Count| |
 +|export.number|Current count of pages being exported| |
 +|export.count|Total Number of pages being exported|  |
 +|doc.rulerunits|Ruler Units|mm|
 +|doc.colorSpace|Document Color Space|RGB|
 +|doc.filename|Document filename|example.ai|
 +|?Question|Uses the text to ask a question| {?Customer Name} will prompt for "Customer Name"|
 +
 +==== History ====
 +The script will save the last 100 items exported to a history list, you can view the exported files, copy the filename or full filename with paths, and open the file (double click on the filename) or open the folder
  
 ==== Release Notes ==== ==== Release Notes ====
 +
 +===== 2.3.3 =====
 +  * Added a Javascript option to allow changing of the path and filename for more automated workflows; for example, use the filename to set the correct path to save to.
 +  * Allowed Subfolder creation in filename template.
 +  * Added History to record exported files and reopen them.
  
 ===== 2.1.0 ===== ===== 2.1.0 =====