SetEmbeddedFileAFRelationship

PDF/UA & accessibilità

Descrizione

Imposta la chiave AFRelationship nel dizionario di specifica del file incorporato. Richiesta da ISO 14289-1 (PDF/UA-1) §7.11 quando in un documento PDF accessibile sono inclusi file incorporati

Sintassi

Delphi

Function TPDFlib.SetEmbeddedFileAFRelationship(Index: Integer; Const AFRelationship: WideString): Integer;

ActiveX

Function PDFlib::SetEmbeddedFileAFRelationship(Index As Long, AFRelationship As String) As Long

DLL

int DLSetEmbeddedFileAFRelationship(int InstanceID, int Index, const wchar_t* AFRelationship);
int DLSetEmbeddedFileAFRelationshipA(int InstanceID, int Index, const char* AFRelationship);

Parametri

IndexIndice con base 1 del file incorporato. Intervallo valido: da 1 a EmbeddedFileCount
AFRelationshipLa relazione del file incorporato con il documento. Deve essere uno dei valori seguenti, che distinguono maiuscole e minuscole:

Source — il file incorporato è il file sorgente usato per creare il documento
Data — il file incorporato contiene dati usati dal documento
Alternative — il file incorporato è una rappresentazione alternativa del contenuto del documento
Supplement — il file incorporato è supplementare al documento
Unspecified — la relazione non è specificata (predefinito quando SetPDFUAMode è attivo)

Valori restituiti

Restituisce 1 in caso di successo. Restituisce 0 se l'indice è fuori intervallo, il valore di AFRelationship non è uno dei cinque valori validi o nessun documento è aperto

Note

Quando SetPDFUAMode è attivo, PDF Library for Delphi imposta automaticamente AFRelationship su Unspecified per ogni file incorporato che non contiene già la chiave. Usare SetEmbeddedFileAFRelationship prima del salvataggio per sostituire il valore predefinito con una relazione più specifica

Chiamare questa funzione dopo aver aggiunto il file incorporato e prima di salvare il documento

Esempio

// PDF/A-3 archive that embeds an XLSX as the document's source data
var
  FileID: Integer;
begin
  PDF.SetPDFAMode(5);              // PDF/A-3b — allows arbitrary embedded files
  PDF.NewDocument;
  PDF.AddTrueTypeFont('Arial {1252}', 1);       // PDF/A requires embedded fonts
  PDF.NewPage;
  PDF.DrawText(50, 750, 'Quarterly Sales Report');

  FileID := PDF.AddEmbeddedFile(
    'sales-Q1.xlsx',
    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  PDF.AddFileAttachment('Source spreadsheet', FileID);

  // Mark the relationship: the spreadsheet is the source of the report
  PDF.SetEmbeddedFileAFRelationship(1, 'Source');

  PDF.SaveToFile('report-PDFA3b.pdf');
end;

Vedere anche

SetPDFUAMode, SetPDFAMode, AddFileAttachment, AddEmbeddedFile, EmbedFile, SetEmbeddedFileStrProperty