AddFileAttachmentA
文件屬性
描述
結尾的 A 表示 ANSI(char)DLL 進入點;ActiveX/COM 介面只提供 Unicode 形式。行為與 AddFileAttachment 完全相同,字串參數依目前 SetAnsiMode 的字碼頁解讀
把既有的內嵌檔案登錄為 PDF 檢視器中的文件層級附件。提供 Attachments 面板的閱讀器會顯示指定的標題,使用者點選時就開啟所參照的內嵌檔案
先呼叫 AddEmbeddedFile 把檔案位元組複製進文件並取得 EmbeddedFileID。AddFileAttachment 接著把該檔案規格加入目錄的 /Names /EmbeddedFiles 名稱樹,不重複複製內嵌位元組。
PDF 版本行為:AddEmbeddedFile 會寫出內嵌檔案串流與檔案規格字典,需要 PDF 1.3;把檔案登錄到文件層級的 /Names /EmbeddedFiles 名稱樹則需要 PDF 1.4。目前文件版本較低且儲存版本未鎖定時,AddFileAttachment 會自動把文件提升到 PDF 1.4,並在 AutoBumpedFeatures 記下 /EmbeddedFiles name tree;呼叫端鎖定了較低的儲存版本時,相容性閘門會以 LastErrorCode 602 拒絕儲存。
語法
Delphi
Function DLAddFileAttachmentA(InstanceID: Integer; Title: PAnsiChar; EmbeddedFileID: Integer): Integer;
DLL
int DLAddFileAttachmentA(int InstanceID, const char * Title, int EmbeddedFileID);
參數
| Title | 檢視器顯示的附件名稱,也是 /EmbeddedFiles 名稱樹中的鍵。不可為空。 |
|---|---|
| EmbeddedFileID | AddEmbeddedFile 傳回的值。 |
傳回值
| 0 | EmbeddedFileID 無效、標題為空,或沒有作用中的文件。 |
|---|---|
| 1 | 內嵌檔案已登錄為文件層級附件。 |
備註
此函式建立文件層級的附件清單條目。要在頁面上放置可點擊的圖示或熱點,請改用 AddLinkToEmbeddedFile;想一次完成內嵌與登錄,請用 EmbedFile。
另見
AddEmbeddedFile, AddLinkToEmbeddedFile, EmbedFile, SetEmbeddedFileAFRelationship, EmbeddedFileCount