PDFium Delphi Component Docs

InspectAvailability method

Component: TPdf  ·  Unit: PDFium
Ask what PDFium can tell about a PDF stream without loading it as a document

Syntax

class function InspectAvailability(AStream: TStream): TPdfAvailability;

AStreamTStream. Seekable stream holding the PDF. It is read but not retained, and its position is restored on return
ResultTPdfAvailability. Record with Linearization (plnUnknown, plnNotLinearized, plnLinearized), DocumentAvailable, FormAvailability (pfaError, pfaNotAvailable, pfaAvailable, pfaNotPresent) and a one-based FirstPageNumber or -1

Description

A class method, so it needs no loaded document and no component instance: it answers whether the bytes are linearised, whether a full parse would succeed and which page a viewer would show first

That is the decision a download path wants before committing: a linearised file can be shown from its first bytes, whilst a non-linearised one has to arrive completely. FirstPageNumber is -1 when PDFium cannot say

pfaNotPresent is the ordinary form answer for a document with no AcroForm at all and is not an error

See Also

LoadCustomDocument, LoadDocument, SaveAsLinearized