Kann jemand mit einem Illustrator-Skript helfen, das Text aus mehreren Dateien in einem Ordner in Gliederungen umwandeln und mit einer bestimmten Voreinstellung meiner Wahl als PDF speichern kann?
Ich konnte bei meinen Recherchen in den Adobe-Foren einige Codezeilen finden, konnte sie jedoch nicht so kombinieren, dass sie irgendwie funktionierten.
Was ich gefunden habe:
https://forums.adobe.com/thread/964576
#Zielillustrator
Funktion outlineDocText( ) {
if ( app.documents.length == 0 ) return;
var docRef = app.activeDocument;
recurseLayers( docRef.layers );
};
outlineDocText();
Funktion recurseLayers( objArray ) {
for ( var i = 0; i < objArray.length; i++ ) {
// Record previous value with conditional change
var l = objArray[i].locked;
if ( l ) objArray[i].locked = false;
// Record previous value with conditional change
var v = objArray[i].visible;
if ( !v ) objArray[i].visible = true;
outlineText( objArray[i].textFrames );
// Recurse the contained layer collection
if ( objArray[i].layers.length > 0 ) {
recurseLayers( objArray[i].layers )
}
// Recurse the contained group collection
if ( objArray[i].groupItems.length > 0 ) {
recurseGroups( objArray[i].groupItems )
}
// Return to previous values
objArray[i].locked = l;
objArray[i].visible = v;
}
};
Funktion recurseGroups( objArray ) {
for ( var i = 0; i < objArray.length; i++ ) {
// Record previous value with conditional change
var l = objArray[i].locked;
if ( l ) objArray[i].locked = false;
// Record previous value with conditional change
var h = objArray[i].hidden;
if ( h ) objArray[i].hidden = false;
outlineText( objArray[i].textFrames );
// Recurse the contained group collection
if ( objArray[i].groupItems.length > 0 ) {
recurseGroups( objArray[i].groupItems )
}
// Return to previous values
objArray[i].locked = l;
objArray[i].hidden = h;
}
};
Funktion outlineText( objArray ) {
// Reverse this loop as it brakes the indexing
for ( var i = objArray.length-1; i >= 0; i-- ) {
// Record previous value with conditional change
var l = objArray[i].locked;
if ( l ) objArray[i].locked = false;
// Record previous value with conditional change
var h = objArray[i].hidden;
if ( h ) objArray[i].hidden = false;
var g = objArray[i].createOutline( );
// Return new group to previous Text Frame values
g.locked = l;
g.hidden = h;
}
};
Danke schön.
Konnte bekommen, was ich wollte. Konvertieren Sie Striche und Text in Konturen und speichern Sie alle Dateien in PDF X-3. Einige Codeteile aus anderen Fragen und Antworten zu ähnlichen Problemen verwendet. Hier ist, was für mich funktioniert hat:
try {
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
if (app.documents.length > 0 ) {
var destFolder = null;
destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~');
if (destFolder != null) {
var options, i, sourceDoc, targetFile;
options = this.getOptions();
while (app.documents.length > 0) {
sourceDoc = app.activeDocument
app.executeMenuCommand("selectall");
app.executeMenuCommand("OffsetPath v22");
app.executeMenuCommand("outline");
targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder);
sourceDoc.saveAs( targetFile, options );
app.activeDocument.close();
}
alert( 'Documents saved as PDF' );
}
}
else{
throw new Error('There are no document open!');
}
}
catch(e) {
alert( e.message, "Script Alert", true);
}
function getOptions()
{ var NamePreset = '[PDF/X-3:2002]';
var options = new PDFSaveOptions();
options.pDFPreset=NamePreset;
return options;
}
function getTargetFile(docName, ext, destFolder) {
var newName = "";
if (docName.indexOf('.') < 0) {
newName = docName + ext;
} else {
var dot = docName.lastIndexOf('.');
newName += docName.substring(0, dot);
newName += ext;
}
var myFile = new File( destFolder + '/' + newName );
if (myFile.open("w")) {
myFile.close();
}
else {
throw new Error('Access is denied');
}
return myFile;
}
joojaa
Joonas
Convert fonts to outlines
in Acrobat Pro ein Droplet erstellen.