EmbeddedFiles

EmbeddedFiles

概述

EmbeddedFiles 是 Aspose.PDF 面向 Go 的 FOSS 中的一种类型。

EmbeddedFiles 是文档中附加(嵌入)文件的集合——/Catalog/Names/EmbeddedFiles 名称树(ISO 32000-1 §7.11.4)。

此类型提供 9 个方法,用于在 Go 程序中操作 EmbeddedFiles 对象。可用的方法包括:Add、AddFromStream、All、Clear、Count、Get、Has、Names、Remove。在安装了 Aspose.PDF 面向 Go 的 FOSS 包后,所有公共成员对任何 Go 应用程序均可访问。

方法

签名描述
Names() → []stringNames 返回附件名称(name-tree 键),按字典序排序。
Count() → intCount 返回嵌入文件的数量。
Has(name: string) → boolHas 报告是否存在具有给定名称的附件。
Get(name: string) → *EmbeddedFileGet 返回命名的附件,如果不存在则返回 nil。
All() → []*EmbeddedFileAll 返回每个附件,按名称排序。
Add(path: string) → (*EmbeddedFile, error)Add 将位于 path 的文件以其基名嵌入,依据扩展名检测 MIME 类型,并返回新的附件。
AddFromStream(name: string, r: io.Reader) → (*EmbeddedFile, error)AddFromStream 将从 r 读取的字节以给定的名称嵌入(MIME 类型根据名称的扩展名检测),并返回新的附件。
Remove(name: string) → boolRemove 删除指定名称的附件,并返回其是否存在。
Clear()Clear 会删除所有附件。

另请参阅

 中文