-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreatePDF.jsx
47 lines (33 loc) · 1.23 KB
/
CreatePDF.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* SCRIPT FOR ILLUSTRATOR
* Save all artboards to a selected folder in widths needed by the Universal Windows Platform Apps.
*
*/
var win = new Window("palette", "SnpCreateProgressBar", [150, 150, 600, 260]);
win.pnl = win.add("panel", [10, 10, 440, 100], "Create PDF");
win.pnl.progBar = win.pnl.add("progressbar", [20, 35, 410, 60], 0, 100);
win.pnl.progBarLabel = win.pnl.add("statictext", [20, 20, 320, 35], "0%");
win.show();
var folder = Folder.selectDialog();
var document = app.activeDocument;
if (document && folder) {
var i, artboard, file, options;
var seiten = [];
for (i = 0; i < document.artboards.length; i++) {
document.artboards.setActiveArtboardIndex(i);
artboard = document.artboards[i];
win.pnl.progBar.value = (i / document.artboards.length) * 100;
win.update();
if (artboard.name.indexOf("Seite") == 0) {
seiten[seiten.length] = i + 1;
}
}
win.pnl.progBarLabel.text = "Design.pdf";
win.update();
file = new File(folder.fsName + "/Design.pdf");
options = new PDFSaveOptions();
options.artboardRange = seiten.join(",");
options.optimization = true;
document.saveAs(file, options);
}
alert('Done!');
win.close();