int32_t __stdcall pdfAnalyseFileA(PPDF IPDF, const char* InputFileName, const char* Password);
int32_t __stdcall pdfAnsiStringResultLength(PPDF IPDF);
function pdfAnalyseFileA(const IPDF: PPDF; InputFileName, Password: PAnsiChar): Integer; stdcall;
function pdfAnsiStringResultLength(const IPDF: PPDF): Integer; stdcall;
Purpose. pdfAnalyseFile reads and inspects an arbitrary, independent PDF file (not the currently-open document or its import source) for basic structural statistics; pdfAnsiStringResultLength reports the exact byte length of the last ANSI (A-suffixed) string result this SDK's shared transient buffer holds — useful because a PAnsiChar result alone can't represent an embedded null byte.
Description. pdfAnalyseFile is genuinely real: opens InputFileName as a completely separate, independent TPdfSourceDoc (decrypted with Password if needed), and records file size, page count, object count (XRef.Count), max object number, PDF header version, whether it's encrypted, and whether it has an AcroForm — into an internal, growable FAnalyses list keyed by an auto-incrementing analysis ID (returned here, consumed later by the separate pdfGetAnalysisInfo getter, not part of this volume's list). Multiple analyses can be retained simultaneously (each gets its own ID), independent of the currently open document. pdfAnsiStringResultLength is a pure accessor — Length(D.GapRetA), the same shared transient ANSI buffer many other A-suffixed the engine functions write their results into.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle (used only for context; the analyzed file is entirely independent of any currently-open document). |
InputFileName | Path to the PDF file to analyze. |
Password | Password to decrypt it, if needed. |
Return value. pdfAnalyseFile: a new analysis ID on success; 0 on failure (file missing/empty/invalid, or bad password). pdfAnsiStringResultLength: the exact byte length of the shared ANSI result buffer's current contents.
C# (P/Invoke)
public static extern int pdfAnalyseFileW(IntPtr IPDF, IntPtr InputFileName, IntPtr Password);
public static extern int pdfAnalyseFile(IntPtr IPDF, IntPtr InputFileName, IntPtr Password);
public static extern int pdfAnalyseFileA(IntPtr IPDF, IntPtr InputFileName, IntPtr Password);
Core
pdfAnalyseFileW
pdfAnalyseFile
pdfAnalyseFileA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.