Skip to content

ExportSettings

typescript
declare type ExportSettings = ExportSettingsImage | ExportSettingsSVG;

ExportSettingsImage

typescript
interface ExportSettingsImage {
  readonly format: "JPG" | "PNG";
  readonly contentsOnly?: boolean;
  readonly useAbsoluteBounds?: boolean;
  readonly suffix?: string;
  readonly constraint?: ExportSettingsConstraints;
}

interface ExportSettingsConstraints {
  readonly type: "SCALE" | "WIDTH" | "HEIGHT";
  readonly value: number;
}

ExportSettingsSVG

typescript
interface ExportSettingsSVG {
  readonly format: "SVG";
  readonly contentsOnly?: boolean;
  readonly useAbsoluteBounds?: boolean;
  readonly suffix?: string;
  readonly svgIdAttribute?: boolean;
}
  • contentsOnly: 是否仅导出节点的内容,默认为 true

  • useAbsoluteBounds: 使用节点的完整尺寸,无论它是否被裁剪或其周围的空间是否为空,默认为 false

  • suffix: 导出时附加到文件名的后缀。 默认为空字符串。

  • constraint: 导出时对图像大小的限制。默认为{ type: "SCALE", value: 1 }

    • SCALE: 导出图像的大小与 Pixso 中导出图层的大小成正比。值为 1 表示导出为图层大小的 100%。
    • WIDTH: 导出的图像被缩放为具有固定的宽度值。
    • HEIGHT:导出的图像被缩放为具有固定的高度值。
  • svgIdAttribute: 是否将图层名称作为 ID 属性包含在 SVG 中。