PDFium Delphi Component Docs

SaveAsWithAssociateFilesToStream method

Componente: TPdf  ·  Unidade: PDFium
Variante em memória de SaveAsWithAssociateFiles — grava a saída do PDF com os arquivos associados injetados em qualquer TStream que suporte busca sem passar pelo disco

Syntax

function SaveAsWithAssociateFilesToStream(Stream: TStream; const Options: TAssocFilesOptions): Boolean;

StreamTStream. The target stream that receives the PDF data
OptionsTAssocFilesOptions. Injection options detailing files, metadata, and the target catalog or page attachment point

Return Value

Retorna True se o PDF com os arquivos associados injetados foi gravado com sucesso no fluxo, ou False em caso de falha

Description

SaveAsWithAssociateFilesToStream é a contraparte de fluxo para SaveAsWithAssociateFiles — incorpora arquivos associados em conformidade com a norma ISO 32000-2 §7.11.4 diretamente no fluxo de saída em vez de um caminho de arquivo

Remarks

Example

var
  Stream: TMemoryStream;
  Opts: TAssocFilesOptions;
  F: TAssociateFile;
begin
  Stream := TMemoryStream.Create;
  try
    Opts := TAssocFilesOptions.Default;
    Opts.TargetPage := 0;

    F.FileName := 'data.xml';
    F.Content := GetXmlBytes;
    F.Relationship := afData;
    F.MIMEType := 'text/xml';

    SetLength(Opts.Files, 1);
    Opts.Files[0] := F;

    if Pdf1.SaveAsWithAssociateFilesToStream(Stream, Opts) then
    begin
      Stream.Position := 0;
      SendToNetwork(Stream);
    end;
  finally
    Stream.Free;
  end;
end;

See Also

SaveAsWithAssociateFiles, SaveAs