Home > SCH_ManufactureData > getExportDocumentFile
SCH_ManufactureData.getExportDocumentFile() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
警告:此 API 现已弃用。
- DEPRECATED since EDA v4.1
获取导出文档文件
签名
function getExportDocumentFile(
fileName?: string,
fileType?: ESCH_ExportDocumentFileType,
typeSpecificParams?: {
theme?: undefined | 'Default' | 'White on Black' | 'Black on White';
lineWidth?: undefined | 'Default' | 'Always 1px' | 'Follow the Zoom Change';
displayAttributesAsMenu?: undefined | false | true;
size?:
| undefined
| string
| { width: number; height: number; unit: ESYS_Unit.MILLIMETER | ESYS_Unit.INCH };
},
object?: 'All Schematic' | 'Current Schematic' | 'Current Schematic Page' | string,
objectSpecificParams?: {
range?: undefined | 'All' | any;
outputMethod?: undefined | 'Merged sheet' | 'Separated sheet';
},
): Promise<File | undefined>;2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
参数名
参数 | 类型 | 描述 |
|---|---|---|
fileName | string | (可选) 文件名 |
fileType | (可选) 文件类型 | |
typeSpecificParams | { theme?: undefined | 'Default' | 'White on Black' | 'Black on White'; lineWidth?: undefined | 'Default' | 'Always 1px' | 'Follow the Zoom Change'; displayAttributesAsMenu?: undefined | false | true; size?: undefined | string | { width: number; height: number; unit: ESYS_Unit.MILLIMETER | ESYS_Unit.INCH } } | (可选) 类型特定参数 |
object | 'All Schematic' | 'Current Schematic' | 'Current Schematic Page' | string | (可选) 对象 |
objectSpecificParams | { range?: undefined | 'All' | any; outputMethod?: undefined | 'Merged sheet' | 'Separated sheet' } | (可选) 对象特定参数 |
返回值
Promise<File | undefined>
导出文档文件数据(或压缩包)
备注
可以使用 SYS_FileSystem.saveFile() 接口将文件导出到本地文件系统
示例
// 1. 把当前图页导出为 PDF('PDF' 对应 ESCH_ExportDocumentFileType.PDF)
// const pdfFile = await eda.sch_ManufactureData.getExportDocumentFile(
// '嘉立创示例_原理图',
// 'PDF',
// undefined,
// 'Current Schematic Page'
// );
// console.log('导出文件名:', pdfFile?.name);
// 2. 也可以导出 PNG 位图,并通过类型特定参数控制主题和线宽
// const pngFile = await eda.sch_ManufactureData.getExportDocumentFile(
// '嘉立创示例_原理图',
// 'PNG',
// { theme: 'Black on White', lineWidth: 'Always 1px' },
// 'All Schematic',
// { outputMethod: 'Separated sheet' } // 多图页时逐页分张输出
// );
// console.log('导出文件名:', pngFile?.name);
// 3. 拿到文件后用 sys_FileSystem.saveFile() 保存到本地
console.log('演示调用:getExportDocumentFile(文件名, 文件类型, 显示参数, 导出范围, 多页参数)');2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21