API referenceImport & Output APIs

pdfEncapsulateContentStream

Wrap the current page's entire content in q … Q so its

Purpose — Wrap the current page's entire content in q … Q so its graphics-state changes cannot leak into content appended afterwards.

Description — Reads the open page's content bytes and rewrites them as q\n<content>Q\n. Typical use: after importing a page with ifImportAsPage or after pdfSetContent, before stamping additional content on top.

C
int32_t __stdcall pdfEncapsulateContentStream(PPDF IPDF);

Return value1 on success; 0 if no page is open (or invalid handle). Integer, not BOOL32.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfEncapsulateContentStream(IntPtr IPDF);
Area
Import & Output APIs
Category

Core

Exported names

pdfEncapsulateContentStream

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.