const char* __stdcall pdfGetImageBuffer(PPDF IPDF, uint32_t* BufSize);
void __stdcall pdfFreeImageBuffer(PPDF IPDF);
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.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
BufSize | Output: 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)
public static extern void pdfFreeImageBuffer(IntPtr IPDF);
Core
pdfFreeImageBuffer
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.