• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

embed all fonts in eps

Participant ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

I have a lot of existing eps-files of which the option "embed all fonts" is unchecked.

Know I have to check the "embed all fonts" in the existing eps-files.

I tried to modify the script below, but it seems that the embedallfonts is NOT working.

When I do it manually (without script), then it works fine. With script, it doesn't work.

#target illustrator

// PART 1

var doc = app.activeDocument;

// PART 2 -> herbewaren eps als eps

var destFile = new File(decodeURI(doc.fullName).replace(/(?: \[Converted\])?\.eps$/, '.eps'));   // also remove "[Converted]" from filename

var options = new IllustratorSaveOptions({});   // new save as options

options.compatibility = Compatibility.ILLUSTRATOR15;   // save as CS5

options.embedICCProfile=true;

options.embedAllFonts=true;

options.pdfCompatible = true;

options.useCompression = true;

doc.saveAs(destFile,  options);  // save the file in the same foldere as the eps

// PART 3

doc.close(SaveOptions.SAVECHANGES);   // close the file with saving

Another question will be: can I get a dialog box to put in the path to the eps-files, I can do thereafter it in batch instead of each time opening and closing a file.

TOPICS
Scripting

Views

6.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Oct 15, 2012 Oct 15, 2012

For the people who are interested. This script asks for a source and target folder, opens an ai or eps file, save to an eps file with fonts embedded, create automatic a scaled png folder and close the file(s).

#target illustrator
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pngExportOpts;

// Selecteer de bronfolder.
sourceFolder = Folder.selectDialog( 'Selecteer de folder met je files die je wil converteren naar PNG', '~' );

// indien folder geselecteerd is dan....
if ( source

...

Votes

Translate

Translate
Adobe
Guru ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

Uncheck this if you don't want name appending…? Sure you can batch a script to work though lots of files…

Screen shot 2012-10-12 at 09.34.09.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

Hello Mark,

Thanks for your tip, but maybe it is my fault, that was not really the problem.

The problem is that the fonts were not embedded at all. There is no error while running. Illustrator closes the file as eps, but when I create a pdf output, the font is not shown.

When I do it manually, there is no problem, so I thought there is something wrong with the script.

Problem 2 is, when you have 400 wrong saved eps-files and you have to open them manually, that it will take a while.

Maybe is there someone that can give me starting script that I can say: that is the folder, open the eps files, resave them as eps with fonts embedded.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

Problem 2 is NO problem at all… Yes you can have script let you choose a folder in Finder/Explorer and filter through the *.eps files you can also choose where to save each too. ( more flexible than actions batch ). First need to work out what is NOT working for you… Are all the required fonts available to the app when opening the files… Any dialogs? or is it all hunky dory?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

The fonts are installed, but my employer was forgotten to check the embed all fonts funtion.

So, I went to the graphic company for preparing all stuff to print it on paper and I get a phone call that the fonts were not embedded in the eps-files.

Now I (or we together with the members of this forum I hope) have to solve this problem.

I get NO errors at all about missing fonts because they are installed here. To solve this problem for future, I want to solve it immediately at a good manner.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

options.embedAllFonts=true; ////// This is wrong… Take a look at the options… What you should have is…

options.fontSubsetThreshold = 100; // This should be default so remove the above line if it still no work add this and try force the issue…

Oh and var options = new IllustratorSaveOptions({}); should just be var options = new IllustratorSaveOptions(); // No {}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

I think the OP wants to use 0 instead of 100 for the subsetting option. This will force the entire font to be embedded.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

You is quite right Larry… I do that myself then forget the default is not the way I like it… empty head…

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 14, 2012 Oct 14, 2012

Copy link to clipboard

Copied

Results is still the same.

In script below I changed the var options to var options=new epssaveoptions() because the existing eps has to be an eps file

I inserted also the embedallfonts line and activated and deactived it (by trial and error)

I also tried to change the subsetthreshold from 100 to 0

What am I doing wrong?

#target illustrator

// PART 1
var doc = app.activeDocument;


// PART 2 -> resave eps as eps

var destFile = new File(decodeURI(doc.fullName).replace(/(?: \[Converted\])?\.eps$/, '.eps'));   // also remove "[Converted]" from filename
var options = new EPSSaveOptions();   // new save as options
options.compatibility = Compatibility.ILLUSTRATOR15;   // save as CS5
options.embedICCProfile=true;
//options.embedallfonts=true;
options.fontSubsetThreshold = 100.0;
options.pdfCompatible = true;
options.useCompression = true;

doc.saveAs(destFile,  options);  // save the file in the same foldere as the eps

// PART 3
doc.close(SaveOptions.DONOTSAVECHANGES);   // close the file with saving

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 14, 2012 Oct 14, 2012

Copy link to clipboard

Copied

It is solved and the script works now!

Solution:

options.embedAllFonts=true;

instead of options.embedallfonts=true;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 15, 2012 Oct 15, 2012

Copy link to clipboard

Copied

LATEST

For the people who are interested. This script asks for a source and target folder, opens an ai or eps file, save to an eps file with fonts embedded, create automatic a scaled png folder and close the file(s).

#target illustrator
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pngExportOpts;

// Selecteer de bronfolder.
sourceFolder = Folder.selectDialog( 'Selecteer de folder met je files die je wil converteren naar PNG', '~' );

// indien folder geselecteerd is dan....
if ( sourceFolder != null )
{
    files = new Array();
    fileType = prompt( 'Welke type files wil je herbewaren als eps met embedded fonts en converteren naar png? Voorbeeld: *.ai', ' ' );
  
    // controleer of alle files aan de juiste extensie voldoen zoals aangegeven hier net boven.
    files = sourceFolder.getFiles( fileType );
  
    if ( files.length > 0 )
    {
        // folder opgeven waar de png-files bewaard moeten worden
        destFolder = Folder.selectDialog( 'Selecteer de folder waar de geconverteerde PNG-bestanden bewaard moeten worden.', '~' );
        for ( i = 0; i < files.length; i++ )
        {
            sourceDoc = app.open(files); // returns the document object
           
                               
            // Call function getNewName to get the name and file to save the pdf
            targetFile = getNewName();
          
            // call funtion getEpsoptions
            epsExportOpts=getEpsOptions();
          
            // Call function getPNGOptions get the PNGExportOptions for the files
            pngExportOpts = getPNGOptions();
          
            // Export as PNG
            sourceDoc.exportFile( targetFile, ExportType.PNG24, pngExportOpts );
           
            // save as eps but with extra options like embed all fonts checked
            sourceDoc.saveAs(targetFile,epsExportOpts);
        }
        alert( 'De bewaarde PNG bestanden staan in volgende folder: ' + destFolder );
    }
    else
    {
        alert( 'Geen files gevonden!' );
    }
}

/*********************************************************
getNewName: Function to get the new file name. The primary
name is the same as the source file.
Functie om de nieuwe filenaam te genereren. De oorspronkelijke naam wordt gebruikt (zonder extensie)
**********************************************************/
function getNewName()
{
    var ext, docName, newName, saveInFile, docName;
    docName = sourceDoc.name;
    ext = '.png'; // nieuwe extensie voor PNG
    newName = "";
      
    for ( var i = 0 ; docName != "." ; i++ )
    {
        newName += docName;
    }
    newName += ext; // volledige naam van nieuw bestand inclusief png-extensie
  
    // nieuwe file maken met correctie extensie
    saveInFile = new File( destFolder + '/' + newName );

    return saveInFile;
}

/*********************************************************
getPNGOptions: Function to set the PNG saving options of the
files using the PDFSaveOptions object.
Hier worden de PNG opties beschreven (= als je een opslaan als selecteert, welke opties je aanvinkt en uitvinkt.
**********************************************************/
function getPNGOptions()
{
  
    // Hier worden de PNG opties beschreven (= als je een opslaan als selecteert, welke opties je aanvinkt en uitvinkt.
    var pngExportOpts = new ExportOptionsPNG24();
  
    // Setting PNGExportOptions properties. Please see the JavaScript Reference
    // for a description of these properties.
    // Add more properties here if you like
    pngExportOpts.antiAliasing = true;
    pngExportOpts.artBoardClipping = false;
    pngExportOpts.horizontalScale = 200;
    //pngExportOpts.matte = true;
    //pngExportOpts.matteColor = 0, 0, 0;
    pngExportOpts.saveAsHTML = false;
    pngExportOpts.transparency = true;
    pngExportOpts.verticalScale = 200;

    return pngExportOpts;
}

function getEpsOptions()
{
    var epsExportOpts = new EPSSaveOptions();   // new save as options
    epsExportOpts.compatibility = Compatibility.ILLUSTRATOR15;   // save as CS5
    epsExportOpts.embedICCProfile=true;
    epsExportOpts.embedAllFonts=true;
    epsExportOpts.fontSubsetThreshold = 100.0;
    epsExportOpts.pdfCompatible = true;
    epsExportOpts.useCompression = true;
    return epsExportOpts;  // save the file in the same foldere as the eps

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines