Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Direct printing to a specific printer
Re: Direct printing to a specific printer [message #46435 is a reply to message #46434] Wed, 11 May 2016 01:18 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 656
Registered: March 2007
Contributor
Turns 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

[Updated on: Wed, 11 May 2016 01:25]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Use Gstreamer with Upp
Next Topic: What is SegtorMap?
Goto Forum:
  


Current Time: Mon Jun 02 22:53:41 CEST 2025

Total time taken to generate the page: 0.02991 seconds