API referenceCore SDK

pdfGetInPDFVersionEx

Read the currently open import file's declared PDF

C
int32_t __stdcall pdfGetInPDFVersion(PPDF IPDF);
int32_t __stdcall pdfGetInPDFVersionEx(PPDF IPDF, PPDFVersionInfo Value);
Delphi
function pdfGetInPDFVersion(const IPDF: PPDF): Integer; stdcall;
function pdfGetInPDFVersionEx(const IPDF: PPDF; Value: PPDFVersionInfo): Integer; stdcall;

Purpose. Read the currently open import file's declared PDF version (not the output document's own version — see pdfGetPDFVersion above).

Description. Fails with the distinct NO_IMPORT_ERR sentinel (an explicit documented DIFF from the classic API's convention) if no import file is open — same pattern as pdfGetInPageCount and several other pdfGetIn* functions in Document Info & Structure Tree. Real version-encoding quirk, explicitly documented in source: the internal ImportPDFVersion ordinal encodes PDF 2.0 as 8; pdfGetInPDFVersion remaps this to 20 before returning it (matching the classic-API convention of encoding PDF 2.0 as 20) so that callers checking for "version >= 20" (a common classic-API idiom for "is this PDF 2.0") see the expected value. pdfGetInPDFVersionEx independently derives Major/Minor from the same raw ordinal (Ord_ < 81.Ord_; Ord_ >= 82.0), so both entry points agree on the PDF-2.0 case despite computing it via different code paths.

Parameters.

ParameterDescription
IPDFDocument handle (with an open import file).
Value*(Ex only)* Output: Major/Minor.

Return value. The remapped version ordinal (PDF 2.0 reported as 20, not the internal 8); NO_IMPORT_ERR if no import file is open; 0 if IPDF invalid.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfGetInPDFVersionEx(IntPtr IPDF, IntPtr Value);
Area
Core SDK
Category

Getters

Exported names

pdfGetInPDFVersionEx

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.