API referenceCore SDK

pdfRestoreGraphicState

Emit a Q (restore graphics state) operator and pop the

C
BOOL32 __stdcall pdfRestoreGraphicState(PPDF IPDF);
Delphi
function pdfRestoreGraphicState(const IPDF: PPDF): LongBool; stdcall;

Purpose. Emit a Q (restore graphics state) operator and pop the tracked CTM stack — the counterpart of pdfSaveGraphicState (Document Info & Structure Tree).

Description. Both pdfSaveGraphicState/pdfRestoreGraphicState are real: they write the actual q/Q content-stream operators and maintain a parallel internal CTM stack (PushCTM/PopCTM) so that pdfGetMatrix (Coordinate Transform and Matrix) correctly reflects the restored transform after a Q, not just the PDF viewer's own state.

Return value. True if there is a current content stream; False otherwise.

See also. pdfSaveGraphicState, pdfGetMatrix.

C# (P/Invoke)

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

Core

Exported names

pdfRestoreGraphicState

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.