API referenceCore SDK

pdfSetAnsiMode

Select whether A-suffixed text parameters in the "gap

C
int32_t __stdcall pdfSetAnsiMode(PPDF IPDF, int32_t NewAnsiMode);
Delphi
function pdfSetAnsiMode(const IPDF: PPDF; NewAnsiMode: Integer): Integer; stdcall;

Purpose. Select whether A-suffixed text parameters in the "gap layer" decode as the system default codepage or as UTF-8.

Description. Real, but stored as a process-wide global (GGapAnsiUTF8), not a per-document field — despite accepting IPDF (used only to validate the handle, not to scope the setting), calling this on one document handle changes ANSI-text decoding behavior for every document handle's subsequent A-suffixed gap-layer calls within the same process, for the remainder of the process's lifetime (or until changed again). This is a real cross-document side effect worth being aware of in any application juggling multiple PPDF handles concurrently.

Parameters.

ParameterDescription
IPDFDocument handle (validity check only — the effect is process-global).
NewAnsiMode0 = system codepage (default); non-zero = UTF-8.

Return value. 1 if IPDF is valid; 0 otherwise.

C# (P/Invoke)

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

Setters

Exported names

pdfSetAnsiMode

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.