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

Simple Export script not working?

New Here ,
Jun 08, 2009 Jun 08, 2009

This code is so simple yet is not working, it is even an example from the scripting pdf:

//------------------------------------------------------------------------

//------------------------------------------------------------------------

var svgOpt = new ExportOptionsSVG();
svgOpt.SVGFontType = 'SVGFONT';
svgOpt.SVGDTDVersion = 'SVG1_0';
svgOpt.SVGCSSPropertyLocation = 'Entities';
var fileSpec = new File("~/sample.svg");
//-------------------------------------------------------------------------------
if (app.documents.length > 0)
{
   
        app.activeDocument.exportFile(fileSpec, ExportType.SVG, svgOpt);
        alert("file exported");
}
else
{
    alert("file NOT exported");
}

//------------------------------------------------------------------------

//------------------------------------------------------------------------

It gives me the prompt that a file was exported however no file is generated.  Does anyone have a suggestion?

Thanks!

TOPICS
Scripting
986
Translate
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
Adobe
New Here ,
Jun 08, 2009 Jun 08, 2009

Ok, I got the file to export, BUT the SVG export options are being ignored.  The SVG is exported as version 1.1 even though it is scripted to export as version 1.0.  This is a very important requirement for these SVG's.

Any idea why this is happening?

Script is here:

aiFolder = Folder.selectDialog ('Select folder to search through');
var svgOpt = new ExportOptionsSVG();
svgOpt.SVGFontType = 'SVGFONT';
svgOpt.SVGDTDVersion = 'SVG1_0';
svgOpt.SVGCSSPropertyLocation = 'ENTITIES';
//var fileSpec = new File("~/sample.svg");
//-------------------------------------------------------------------------------
if (app.documents.length > 0)
{
   
        app.activeDocument.exportFile(aiFolder, ExportType.SVG, svgOpt);
        alert("file exported");
}
else
{
    alert("file NOT exported");
}
   
        //sourceDoc.saveAs(aiFolder, aiOpt);
        //app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

Thanks

Translate
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
LEGEND ,
Jun 08, 2009 Jun 08, 2009

Loose the quotes around the properties, I.e. SVGFONT, SVG1_0, ENTITIES.

Translate
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
New Here ,
Jun 08, 2009 Jun 08, 2009

Thanks for the quick response, unfortunately it does not work.

I tried without the quotes:

svgOpt.SVGFontType = SVGFONT;
svgOpt.SVGDTDVersion = SVG1_0;
svgOpt.SVGCSSPropertyLocation = ENTITIES;

but I get an error:

"SVGFONT is undefined"

Translate
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
New Here ,
Jun 08, 2009 Jun 08, 2009
LATEST

Thanks for the suggestion, I got it to work.  I had the option declarations wrong as well.

This works perfectly now:

var svgOpt = new ExportOptionsSVG();
svgOpt.fontType = SVGFontType.SVGFONT;
svgOpt.DTD = SVGDTDVersion.SVG1_0;
svgOpt.cssProperties = SVGCSSPropertyLocation.ENTITIES;

Translate
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