StoreCustomDataFromString

文件屬性

描述

把自訂資料以鍵名存進 PDF,之後可用 RetrieveCustomDataToString、RetrieveCustomDataToVariant 或 RetrieveCustomDataToFile 函式取出。可設定儲存類型(字串、串流或壓縮串流)與位置(Document Information Dictionary 或 Document Catalog)。位置為 Document Catalog 時任何儲存類型都可以,但鍵必須加上 Adobe 核配給你的特殊字首;位置為 Document Information Dictionary 時,除標準鍵以外的任何鍵都能用,但只能存字串

Location 為 2 時,目錄系統鍵受到保護,會傳回 0 而不是被覆寫。保留集合包括 OutputIntents、Extensions、Requirements、Collection 與 NeedsRendering

語法

Delphi

Function TPDFlib.StoreCustomDataFromString(Const Key, NewValue: AnsiString; Location, Options: Integer): Integer;

DLL

int DLStoreCustomDataFromString(int InstanceID, const char * Key, const char * NewValue, int Location, int Options);

參數

Key儲存資料所用的鍵。位置為 Document Information Dictionary 時,鍵不能是 "Author"、"Title"、"Subject"、"Keywords"、"Creator" 或 "Producer";其他任何鍵都可以,但應審慎挑選,讓使用者看得懂。位置為 Document Catalog 時,鍵必須加上 Adobe 核配給你的特殊字首,避免與其他軟體衝突
NewValue資料的新值
Location1 = 將資料儲存在 Document Information Dictionary 中 2 = 將資料儲存在 Document Catalog 中
Options0 = 將資料儲存為字串(位置為 Document Information Dictionary 時唯一可用的選項) 1 = 將資料儲存在串流中 2 = 將資料儲存在壓縮串流中

傳回值

0因為鍵名是保留名稱,無法儲存資料
1資料儲存成功