API referenceImages

pdfFreeImageBuffer

Return the raw encoded/decoded byte buffer of the

C
const char* __stdcall pdfGetImageBuffer(PPDF IPDF, uint32_t* BufSize);
void __stdcall pdfFreeImageBuffer(PPDF IPDF);
Delphi
function pdfGetImageBuffer(const IPDF: PPDF; var BufSize: Cardinal): PAnsiChar; stdcall;
procedure pdfFreeImageBuffer(const IPDF: PPDF); stdcall;

Purpose. Return the raw encoded/decoded byte buffer of the most-recently-inserted image (see the chapter note above — not the pdfSelectImage cursor).

Description. Copies FImages[FImageCount-1].Data into a document-owned transient buffer (FImgGetBuf) and returns a pointer into it, valid until the next call that reuses the same buffer (or until pdfFreeImageBuffer, which explicitly releases it via FreeImageBuffers). Fails (returns nil, BufSize=0) if no image has ever been inserted.

Parameters.

ParameterDescription
IPDFDocument handle.
BufSizeOutput: byte length of the returned buffer.

Return value. pdfGetImageBuffer: pointer to the buffer, or nil if no image exists / IPDF invalid / BufSize is a null pointer. pdfFreeImageBuffer: none.

See also. pdfSaveImageToString (the selected-image counterpart).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern void pdfFreeImageBuffer(IntPtr IPDF);
Area
Images
Category

Core

Exported names

pdfFreeImageBuffer

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.