SetEmbeddedFileAFRelationship

PDF/UA & accesibilidad

Descripción

Establece la clave AFRelationship en el diccionario de especificación de archivo para un archivo incrustado Requerido por ISO 14289-1 (PDF/UA-1) §7.11 cuando se incluyen archivos incrustados en un documento PDF accesible

Sintaxis

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);

Parámetros

IndexÍndice de base cero del archivo incrustado. Rango válido: 0 a EmbeddedFileCount - 1
AFRelationshipLa relación del archivo incrustado con el documento. Debe ser uno de los siguientes valores que distinguen mayúsculas y minúsculas:

Source — el archivo incrustado es el archivo fuente utilizado para crear el documento
Data — el archivo incrustado contiene datos utilizados por el documento
Alternative — el archivo incrustado es una representación alternativa del contenido del documento
Supplement — el archivo incrustado complementa el documento
Unspecified — la relación no se especifica (predeterminado cuando SetPDFUAMode está activo)

Valor devuelto

Devuelve 1 si se realiza correctamente. Devuelve 0 si el índice está fuera de rango, el valor AFRelationship no es uno de los cinco valores válidos o no hay ningún documento abierto

Observaciones

Cuando SetPDFUAMode está activo, PDF Library for Delphi establece automáticamente AFRelationship en Unspecified para cualquier archivo incrustado que todavía no tenga la clave. Use SetEmbeddedFileAFRelationship antes de guardar para reemplazar este valor predeterminado por un valor de relación más específico

Llame a esta función después de agregar el archivo incrustado y antes de guardar el documento

Ejemplo

// 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.AddStandardFont('Helvetica');
  PDF.AddPage;
  PDF.PrintText(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;

Véase también

SetPDFUAMode, SetPDFAMode, AddFileAttachment, AddEmbeddedFile, EmbedFile, SetEmbeddedFileStrProperty