BOOL32 __stdcall pdfPrintPageA(PPDF IPDF, uint32_t PageNum, const char* DocName, HDC DC, TPDFPrintFlags Flags, PRectL Margin, PPDFPrintParams Parms);
BOOL32 __stdcall pdfPrintPDFFileA(PPDF IPDF, const char* TmpDir, const char* DocName, HDC DC, TPDFPrintFlags Flags, PRectL Margin, PPDFPrintParams Parms);
function pdfPrintPageA(const IPDF: PPDF; PageNum: Cardinal; const DocName: PAnsiChar; DC: HDC; Flags: TPDFPrintFlags; const Margin: PRectL; const Parms: PPDFPrintParams): LongBool; stdcall;
function pdfPrintPDFFileA(const IPDF: PPDF; const TmpDir, DocName: PAnsiChar; DC: HDC; Flags: TPDFPrintFlags; const Margin: PRectL; const Parms: PPDFPrintParams): LongBool; stdcall;
Purpose. The real print-execution pair: pdfPrintPage prints one page onto an already-prepared printer DC; pdfPrintPDFFile prints the whole document, wrapping the loop in a genuine StartDoc/ StartPage/EndPage/EndDoc GDI print job.
Description. Both are real, working GDI print implementations — render each page to an RGB24 buffer (RenderPageRGBStruct), repack it into a DWORD-aligned top-down BGR DIB (GDI's required scanline format, converted from the engine's native tightly-packed RGB), determine the DC's actual printable area (GetClipBox, falling back to GetDeviceCaps(HORZRES/VERTRES)), aspect-fit the page within it (honoring Margin), and blit via StretchDIBits. pdfPrintPDFFile loops this per page inside a real StartDoc/StartPage/EndPage/EndDoc job — one physical printed page per PDF page — falling back to the import source's page count if the live document has none. Ignored parameters, both functions: Flags (TPDFPrintFlags) and Parms (PPDFPrintParams) are accepted by the ABI but never passed into the shared rendering helper (PrintPageToDC(D, PageIdx, DC, Margin) — only 4 parameters, no Flags/Parms at all). Neither function consults the document-level print settings (pdfSetPrintSettings, below) either — PrintPageToDC always aspect-fits the whole page to the DC's own drawable area regardless of any configured duplex mode, copy count, tray pick, or scaling mode; a caller wanting multiple physical copies, specific tray selection, or non-fit-to-page scaling must configure the DC's own DEVMODE before calling these functions, since none of that configuration is applied automatically by this SDK.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
PageNum | *(PrintPage only)* 1-based page to print. |
TmpDir | *(PrintPDFFile only)* Accepted; not observed to be used (no temp file is created — rendering is direct in-memory). |
DocName | Passed to StartDoc's lpszDocName (the job name shown in the print queue) — *(PrintPDFFile only; pdfPrintPage doesn't call StartDoc at all, so its own DocName is unused by this function — the caller is expected to have already wrapped it in its own StartDoc/StartPage)*. |
DC | The target device context; must already be a valid printer (or compatible) DC. |
Flags, Parms | Accepted by both functions but never passed through to the actual rendering — no observable effect. |
Margin | Genuinely honored — insets the aspect-fit placement within the DC's drawable area. |
Return value. True on success; False if DC is invalid, the page/document has no content, or (for pdfPrintPDFFile) StartDoc fails.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Printing
pdfPrintPageA
pdfPrintPageW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.