PDFium Delphi Component Docs

TPdfStreamInspector 클래스

유닛: FPdfStreamInspect
임의의 물리적 PDF 스트림 객체를 읽기 전용으로 한도 있게 목록화하고 추출합니다

Syntax

type TPdfStreamInspector = class ... end;

Constructors

ConstructorDescription
Create(Source: TStream)기본 예산 아래에서 시크 가능한 PDF 소스를 읽고 원래 위치를 복원합니다
Create(Source: TStream; const Options: TPdfStreamInspectOptions)호출자가 고른 예산 아래에서 시크 가능한 PDF 소스를 읽습니다
Create(const Data: TBytes)기본 예산 아래에서 기존 PDF 바이트 배열을 검사합니다
Create(const Data: TBytes; const Options: TPdfStreamInspectOptions)호출자가 고른 예산 아래에서 기존 PDF 바이트 배열을 검사합니다

Methods

MethodDescription
CopyRawData(Index, Destination, out Report)스트림 객체 하나의 인코딩된 페이로드 전체를 복사합니다
CopyRawData(Index, Destination, Offset, Count, out Report)필터 체인을 디코딩하지 않고 검증된 바이트 창을 복사합니다
DecodeData(Index, Destination, Level, out Report)raw 데이터를 반환하거나 선언 순서대로 지원되는 일반 필터를 적용합니다
PdfStreamFilterKindFromName(Name)전체 또는 축약 PDF 필터 이름을 TPdfStreamFilterKind로 매핑합니다

Default limits

ConstantValuePurpose
PdfStreamInspectDefaultSourceLimit512 MiB보유하는 소스의 최대 크기
PdfStreamInspectDefaultRawLimit256 MiB연산 한 번이 복사하는 raw 페이로드의 최대 크기
PdfStreamInspectDefaultDecodedLimit256 MiB연산 한 번이 만들어내는 디코딩된 페이로드의 최대 크기
PdfStreamInspectDefaultExpansionRatio100디코딩 대 인코딩 확장 비율의 최댓값
PdfStreamInspectDefaultMaxStreams1,000,000목록화하는 스트림 객체의 최대 수
PdfStreamInspectDefaultDictionaryLimit1 MiB스트림 하나당 검사하는 딕셔너리 바이트의 최대 크기

Public types

TypeDescription
TPdfStreamFilterKind필터를 psfkUnknown, psfkASCIIHex, psfkASCII85, psfkLZW, psfkFlate, psfkRunLength, psfkCCITTFax, psfkJBIG2, psfkDCT, psfkJPX, psfkCrypt, psfkBrotli로 분류합니다
TPdfStreamNativeAccess네이티브 경로 없음, 이미지 객체 접근, 임베디드 파일 접근 중 하나를 고릅니다
TPdfStreamDecodeLevelraw, 지원되는 일반 필터, 필수 전체 체인 디코딩 중 하나를 고릅니다
TPdfStreamReadStatuspsrsCompleted, psrsPartiallyDecoded, psrsInvalidIndex, psrsInvalidRange, psrsSourceLimitExceeded, psrsRawLimitExceeded, psrsDecodedLimitExceeded, psrsExpansionRatioExceeded, psrsUnsupportedFilter, psrsUnsupportedDecodeParameters, psrsEncrypted, psrsExternalData, psrsMalformed, psrsWriteError를 보고합니다
TPdfStreamFilterInfo필터 이름, Kind, DecodeParms 존재 여부인 HasDecodeParameters, Predictor, Colors, BitsPerComponent, Columns, LZW EarlyChange 값입니다
TPdfStreamFilterInfosTPdfStreamFilterInfo 레코드의 동적 배열입니다
TPdfStreamInfo객체 식별(ObjectNumber, Generation, TypeName), 오프셋과 길이(ObjectOffset, DictionaryOffset, DictionaryLength, RawOffset, RawLength, DecodedLengthHint), 배치 플래그(LengthIsIndirect, UsedEndStreamFallback), 암호화와 외부 파일 플래그(HasExternalFile, IsEncryptedDocument), 유형 이름(SubtypeName), 네이티브 경계(psnaNone, psnaImageObject, psnaEmbeddedFile 중 하나인 NativeAccess), 선언된 Filters 체인입니다
TPdfStreamInfosTPdfStreamInfo 레코드의 동적 배열입니다
TPdfStreamInspectOptions소스, 페이로드(MaxRawBytes, MaxDecodedBytes), 확장(MaxExpansionRatio), 객체 수(MaxStreams), 딕셔너리(MaxDictionaryBytes), 토큰(MaxTokens), 할당(MaxAllocationBytes), DeadlineMilliseconds 마감 예산을 호출자가 고르며 static Default 초기화자를 제공합니다
TPdfStreamReadReport한 번의 읽기에 대한 상태, 바이트 수(InputByteCount, OutputByteCount), 적용된 필터와 남은 필터 수(AppliedFilterCount, RemainingFilterCount), 실패한 필터 인덱스(FailedFilterIndex), ErrorMessage 텍스트입니다

Properties

MemberTypeDescription
CountInteger소스에서 발견된 물리적 스트림 객체 또는 리비전 수
Infos[Index]TPdfStreamInfo객체 번호, 세대, 오프셋, 길이, 필터, DecodeParms, 네이티브 접근 분류입니다
EncryptedBoolean트레일러가 문서 암호화를 선언하는지 여부
OptionsTPdfStreamInspectOptions검사기가 사용하는 정규화된 리소스 예산입니다
SourceByteCountInt64검사를 위해 보유한 입력 바이트 수

Decode levels and native boundaries

Budgets and reports

TPdfStreamInspectOptions.Default는 소스, 페이로드, 확장, 딕셔너리, 스트림 상한을 현재 TPdfParserResourceBudget의 토큰, 객체, 디코딩 바이트, 확장 비율, 할당, 마감 정책과 결합합니다

TPdfStreamReadReport는 상태, 입력 및 출력 바이트 수, 적용된 필터와 남은 필터, 실패한 필터 인덱스, 대상 쓰기 오류를 기록합니다

현재 구현은 신뢰할 수 있는 간접 길이 해석과 반복 가능한 임의 스트림 읽기를 지원하기 위해 한도 있는 소스 복사본 하나를 보유합니다. 더 타이트한 메모리 예산 아래에서 신뢰할 수 없는 업로드를 처리할 때는 더 낮은 MaxSourceBytes를 사용하세요

Example

var
  Inspector: TPdfStreamInspector;
  Output: TMemoryStream;
  Report: TPdfStreamReadReport;
begin
  Inspector := TPdfStreamInspector.Create(PdfBytes);
  Output := TMemoryStream.Create;
  try
    if Inspector.Count > 0 then
      Inspector.DecodeData(0, Output, psdlGeneral, Report);
  finally
    Output.Free;
    Inspector.Free;
  end;
end;