Home » Community » Newbie corner » Direct printing to a specific printer
| Re: Direct printing to a specific printer [message #61857 is a reply to message #46435] |
Wed, 19 November 2025 13:09  |
fzx374cn
Messages: 9 Registered: August 2025
|
Promising Member |
|
|
Lance wrote on Wed, 11 May 2016 01:18Turns out it's even easier. The following code succeeded on my windows 8 system.
{
HDC hdc = CreateDC( "WINSPOOL", "Microsoft XPS Document Writer", NULL, NULL);
if(hdc) {
One<PrintDraw> d = new PrintDraw(hdc, "My Printing Job Name");
LOG("Printer Draw OK");
d->DrawText(10,20,"Test",StdFont().Height(720),Black());
d->EndPage();
DeleteDC(hdc);
}
}
You should replace "Microsoft XPS..." with your actual printer name (who doesn't need to be the default printer.
HTH,
Lance
---------------------------------------------
U++, Ver 17810, Test ok, But need comment out "DeleteDC(hdc);"。
|
|
|
|
Goto Forum:
Current Time: Sat Nov 29 06:31:39 CET 2025
Total time taken to generate the page: 0.24520 seconds
|