PDFium Delphi Component Docs

AttachmentRelationship Proprietà

Componente: TPdf  ·  Unità: PDFium
Restituisce il nome /AFRelationship del file incorporato all'indice specificato basato su zero, oppure una stringa vuota quando la file specification non lo contiene

Sintassi

property AttachmentRelationship[Index: Integer]: WString; // read only

Descrizione

I file associati di PDF 2.0 (ISO 32000-2 §7.11.4) marcano ogni file specification con un nome /AFRelationship che dichiara come il file incorporato si rapporta al contenuto a cui è allegato: Source, Data, Alternative, Supplement, EncryptedPayload, FormData, Schema o Unspecified (Table 43). Le fatture PDF/A-3 e ZUGFeRD / Factur-X fanno affidamento su questa voce per marcare il payload XML leggibile dalle macchine

La proprietà legge la voce attraverso l'esportazione nativa FPDFAttachment_GetAFRelationship e restituisce il name token grezzo come stringa Unicode. Restituisce una stringa vuota quando la file specification non ha una voce /AFRelationship, quando la voce non è un name, oppure quando la pdfium.dll caricata è anteriore all'esportazione (vedere AttachmentRelationshipFeaturesAvailable)

La proprietà è di sola lettura. Per allegare file con una relazione usare il writer lato Pascal in FPdfAssocFiles, che emette gli stessi name token

Parametri

IndexInteger. Slot degli allegati basato su zero. Deve soddisfare 0 <= Index < AttachmentCount; altri valori sollevano una EPdfError (Incorrect attachment index)

Osservazioni

Esempio

var
  I: Integer;
begin
  Pdf1.Active := True;
  Pdf1.FileName := 'invoice-facturx.pdf';
  Pdf1.Active := True;
  for I := 0 to Pdf1.AttachmentCount - 1 do
    if Pdf1.AttachmentRelationship[I] = 'Alternative' then
      SaveInvoiceXml(Pdf1.AttachmentName[I], Pdf1.Attachment[I]);
end;

Vedi anche

AttachmentName, AttachmentType, AttachmentDescription, ReadAttachmentMetadata, AttachmentRelationshipFeaturesAvailable