PDFium Delphi Component Docs

SaveAsWithAssociateFilesToStream method

Component: TPdf  ·  Unit: PDFium
Biến thể trong bộ nhớ của SaveAsWithAssociateFiles — ghi kết quả PDF với các tệp liên kết được chèn vào bất kỳ TStream nào có thể tìm kiếm mà không cần lưu tạm qua đĩa

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

Trả về True nếu PDF với các tệp liên kết được chèn đã được ghi thành công vào luồng, hoặc False khi thất bại

Description

SaveAsWithAssociateFilesToStream là phiên bản luồng tương đương với SaveAsWithAssociateFiles — nó nhúng các tệp liên kết tuân thủ ISO 32000-2 §7.11.4 trực tiếp vào luồng đầu ra thay vì đường dẫn tệp

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