pdfSaveFontToFile
Write the currently active font's raw font-program bytes to a
| Category | Font export |
|---|---|
| Exported names | pdfSaveFontToFileA, pdfSaveFontToFileW, pdfSaveFontToFile |
| Note | operates on the current font only, and saves the whole original file, not a subset (see Remarks) |
Purpose — Write the currently active font's raw font-program bytes to a file.
Declarations
int32_t __stdcall pdfSaveFontToFile(PPDF IPDF, const char* FileName);
int32_t __stdcall pdfSaveFontToFileA(PPDF IPDF, const char* FileName);
int32_t __stdcall pdfSaveFontToFileW(PPDF IPDF, const wchar_t* FileName);
function pdfSaveFontToFileA(const IPDF: PPDF; FileName: PAnsiChar): Integer; stdcall; external 'LumasPdf.dll';
function pdfSaveFontToFileW(const IPDF: PPDF; FileName: PWideChar): Integer; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
FileName | string | Output path. |
Return value — 1 on success; 0 if no font is currently active, the active font isn't a TrueType font (standard-14, Type 1, and CID-predefined fonts have no extractable byte buffer through this call and always fail), or the file write fails.
**Remarks — two things this call does *not* do. (1) There is no font handle parameter — it always operates on whatever font pdfChangeFont/ pdfSetFont last selected as current; switch to the target font first. (2) It writes the complete, original TrueType font file bytes exactly as loaded** — not a subset reflecting only the glyphs actually used in the document, despite this chapter's subsetting-adjacent naming context. For subsetting concerns, see pdfUpdateTrueTypeSubsettedFont, which tracks *which glyphs* are used but does not itself produce a subsetted file via this call.
C# (P/Invoke)
public static extern int pdfSaveFontToFileW(IntPtr IPDF, IntPtr FileName);
public static extern int pdfSaveFontToFile(IntPtr IPDF, IntPtr FileName);
public static extern int pdfSaveFontToFileA(IntPtr IPDF, IntPtr FileName);
Core
pdfSaveFontToFileW
pdfSaveFontToFile
pdfSaveFontToFileA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.