首页 > 解决方案 > 如何使用以及在哪里可以找到 Adob​​e Illustrator api C# 中的导出参数

问题描述

我在我的应用程序中使用 illustrator api

    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);

我想使用 illustrator 格式将我的 svg 转换为 1.2 微小格式。函数 app.ActiveDocument.Export 可以做到。它有 3 个参数:文件名、格式和参数。需要的参数:小数位=1 和图像位置=链接,因为它最适合我的解析器。

链接那个

当然,我无法搜索如何在此功能中包含这些选项的任何信息。请不要向我推荐任何其他库或inkscape。谢谢

标签: c#.netasp.net-coreadobeadobe-illustrator

解决方案


你可以在枚举中找到你的小 svg 1.2 版本

Illustrator.AiSVGDTDVersion.aiSVGTiny1_2

也许你认为你可以创建选项类的对象:

Illustrator.ExportOptionsSVGClass

但是当您尝试创建这些对象时,您会收到错误消息。您的解决方案是:

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);
        

推荐阅读