DAOpenFromURL

Document management, Direct access functionality

Description

Opens a remote PDF over HTTP for direct access using byte-range requests

The transport probes the URL once to confirm byte-range support and learn the total length, then a seekable stream drives the existing random-access reader so that only the objects actually read are fetched over the network

When the document is linearized and cache warming is enabled, the first-page section is prefetched within the retained-byte budget so page 1 renders before the rest of the file is touched

Syntax

Delphi

Function TPDFlib.DAOpenFromURL(Const URL, Password: WideString; Options: Integer= 0; ChunkSize: LongInt= 0; CacheLimitBytes: Int64= 0; CoalesceWindowMS: Cardinal= PDF_NET_DEFAULT_COALESCE_WINDOW_MS): Integer;

DLL

int DLDAOpenFromURL(int InstanceID, const wchar_t* URL, const wchar_t* Password, int Options);

ActiveX

Function PDFlib::DAOpenFromURL(URL As String, Password As String, Options As Long) As Long

Parameters

URLThe http or https address of the remote PDF
PasswordThe document password, or an empty string when the PDF is not encrypted
OptionsZero for the default warmed first-page open, or PDF_NET_OPT_NO_WARMING to open purely on demand
ChunkSizeDelphi only; the aligned range-fetch granularity, with zero selecting 64 KiB
CacheLimitBytesDelphi only; the maximum retained source bytes, with zero selecting 4 MiB and values below one chunk raised to one chunk
CoalesceWindowMSDelphi only; the collection window for the first uncached chunk of each absolute read, with 2 milliseconds as the default and zero disabling the initial delay

Return values

>0A direct-access document handle
0The document could not be opened; LastErrorCode is set to PDFLIB_ERROR_NET_OPEN, PDFLIB_ERROR_NET_RANGE_UNSUPPORTED, PDFLIB_ERROR_NET_HTTP, or a structure or password code

Remarks

The server must advertise byte-range support; otherwise the call fails fast with PDFLIB_ERROR_NET_RANGE_UNSUPPORTED rather than downloading the whole file

Close the returned handle with DACloseFile, which also releases the underlying transport stream

Concurrent deferred reads share same-chunk requests and combine adjacent queued chunks into source reads capped at 16 MiB

Use GetLinearizedURLAccessPlan to inspect the byte-range layout of page 1 without opening the document

Use DAGetRangeSourceCacheInfo, DASetRangeSourceCacheLimit and DAClearRangeSourceCache to observe or change a Delphi direct-access cache