THotPDF.DecodeLoadedStreamToStream 方法

透過完整篩選器鏈解碼已載入的 PDF 串流,並將最終階段直接寫入呼叫端擁有的串流

宣告

function DecodeLoadedStreamToStream(AStream: THPDFStreamObject; Output: TStream; out Info: THPDFDecodePipelineInfo): boolean;

單元

HPDFDoc

參數

名稱用途
AStream要解碼其 /Filter 項目的已載入 THPDFStreamObject
Output呼叫端擁有的目的地,在其目前位置接收已解碼位元組
Info接收輸入與輸出位元組計數、篩選器計數、深度、狀態、失敗的篩選器與診斷
Info接收輸入與輸出位元組數、filter 計數、深度、狀態、失敗的 filter 與診斷資訊

傳回值

僅當每個要求的階段都成功時才傳回 True

使用說明

診斷

THPDFDecodePipelineInfo = record
  Status: THPDFDecodePipelineStatus;
  InputBytes: Int64;
  OutputBytes: Int64;
  FilterCount: Integer;
  AppliedFilterCount: Integer;
  PipelineDepth: Integer;
  StopBeforeLast: Boolean;
  FailedFilter: AnsiString;
  Diagnostic: AnsiString;
end;

Status 區分無效的串流與篩選器、篩選器計數與深度限制、循環參考、遞迴串流、不支援的篩選器、預算失敗與解碼器失敗

範例

Output := TFileStream.Create('payload.bin', fmCreate);
try
  if not PDF.DecodeLoadedStreamToStream(StreamObject, Output, Info) then
    raise Exception.Create(String(Info.Diagnostic));
finally
  Output.Free;
end;

相關 API