简体   繁体   中英

how to use and where i can find export params in Adobe Illustrator api C#

I am using illustrator api in my app

    Illustrator.Application app = new Illustrator.Application();
    app.Open("D:\\1\\2\\1.svg");
    app.ActiveDocument.Activate();
    app.ActiveDocument.Export("D:\\1\\2\\1_1.svg", Illustrator.AiExportType.aiSVG);
    app.ActiveDocument.Close(Illustrator.AiSaveOptions.aiDoNotSaveChanges);

I want to convert my svg to 1.2 tiny format using illustrator formating. Function app.ActiveDocument.Export can do it. It has 3 params: fileName, format and params. Wanted params: decimal places=1 and image location=link, because it is best for my parser.

链接那个

Of course I can't search any information how to include these options in this function. Please do not recommend me any other libraries or inkscape. Thanks

You can find your tiny svg 1.2 version in enum

Illustrator.AiSVGDTDVersion.aiSVGTiny1_2

Maybe you are think that you can create object of options class:

Illustrator.ExportOptionsSVGClass

But when you are try to create these object you get an error. Your solution is:

var options = new ExportOptionsSVG();
            options.SVGTextOnPath = true;
            options.IncludeUnusedStyles = false;
            options.IncludeFileInfo = false;
            options.EmbedRasterImages = true;
            options.DTD = AiSVGDTDVersion.aiSVGTiny1_2;
            app.ActiveDocument.Export("path", AiExportType.aiSVG, options);
        

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM