property AttachmentRelationship[Index: Integer]: WString; // read only
PDF 2.0 の associated file(ISO 32000-2 §7.11.4)では、各 file specification に /AFRelationship 名が付きます。これは埋め込みファイルが添付先のコンテンツとどう関係するかを示すもので、Source、Data、Alternative、Supplement、EncryptedPayload、FormData、Schema、Unspecified のいずれかです(Table 43)。PDF/A-3 や ZUGFeRD / Factur-X のインボイスは、機械可読な XML payload を示すためにこのエントリに依存しています
このプロパティはネイティブの FPDFAttachment_GetAFRelationship エクスポート経由でエントリを読み取り、名前トークンをそのまま Unicode 文字列として返します。file specification に /AFRelationship エントリがない場合、エントリが name ではない場合、読み込んだ pdfium.dll がこのエクスポートより古い場合(AttachmentRelationshipFeaturesAvailable を参照)は空文字列を返します
このプロパティは読み取り専用です。relationship を指定してファイルを添付するには、同じ名前トークンを出力する FPdfAssocFiles の Pascal 側ライターを使ってください
| Index | Integer. 0 基準の添付ファイルスロットです。0 <= Index < AttachmentCount を満たす必要があり、範囲外の値では EPdfError(Incorrect attachment index)が発生します |
/EmbeddedFiles name tree に登録された添付だけです。/AF 配列からのみ参照される関連ファイルは、このプロパティからはアクセスできません(AttachmentCount を参照)TPdfAttachmentMetadata の Relationship フィールドに同じ値を格納します。また TryGetAnnotationFileAttachment は file attachment 注釈に対して対応するフィールドを設定します
var
I: Integer;
begin
Pdf1.LoadFromFile('invoice-facturx.pdf');
for I := 0 to Pdf1.AttachmentCount - 1 do
if Pdf1.AttachmentRelationship[I] = 'Alternative' then
SaveInvoiceXml(Pdf1.AttachmentName[I], Pdf1.Attachment[I]);
end;