API referenceCore SDK

pdfSetViewerPreferences

Get/set the document's /ViewerPreferences dictionary

C
BOOL32 __stdcall pdfGetViewerPreferences(PPDF IPDF, int32_t* Preference, int32_t* AddVal);
BOOL32 __stdcall pdfGetViewerPrefrences(PPDF IPDF, int32_t* Preference, int32_t* AddVal);
BOOL32 __stdcall pdfSetViewerPreferences(PPDF IPDF, int32_t Value, int32_t AddVal);
Delphi
function pdfGetViewerPreferences(const IPDF: PPDF; Preference, AddVal: PInteger): LongBool; stdcall;
function pdfSetViewerPreferences(const IPDF: PPDF; Value, AddVal: Integer): LongBool; stdcall;

Purpose. Get/set the document's /ViewerPreferences dictionary bit-flags plus one auxiliary numeric value.

Description. pdfGetViewerPrefrences (missing the second "e" in "Preferences") is a genuine DLL export — confirmed in the module's export table as an explicit alias for the exact same implementation as pdfGetViewerPreferences, per a source comment: "typo'd 'pdfGetViewerPrefrences' aliased to the correctly-spelt export." This preserves an equivalent typo present in the classic API's official API surface, for drop-in compatibility with code already written against that misspelled name — it is not a bug in this SDK, but a deliberately preserved compatibility alias.

Parameters.

ParameterDescription
IPDFDocument handle.
Preference/ValueThe /ViewerPreferences bit-flags.
AddValAn auxiliary numeric value (e.g. for preferences like /NumCopies that pair a flag with a count).

Return value. True on success; False if IPDF is invalid.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Core SDK
Category

Setters

Exported names

pdfSetViewerPreferences

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.