Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Printing

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32
Win32  
Author Message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon May 13, 2019 4:48 pm    Post subject: Printing Reply with quote

ms - Retrieve a Printer Device Context

"You can obtain the exact printer name string to pass to CreateDC by calling
the EnumPrinters function. The following code example shows how to call
EnumPrinters and get the names of the local and locally connected printers."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu May 30, 2019 7:50 pm    Post subject: Reply with quote

How to Change Default Printer Settings in an MFC Applicat

"To change the default printer settings in an MFC application, you must
retrieve the system default settings in a CWinApp derived object and modify
those defaults before a print job is invoked."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jun 03, 2019 3:49 pm    Post subject: Reply with quote

ms - How To Modify Printer Settings by Using SetPrinter

"SetPrinter is a new API for Windows 95, Windows NT, Windows 2000, and
Windows XP that allows applications to change various printer attributes.
However, as the code in this article demonstrates, a certain amount of
preparation is necessary in order to call SetPrinter correctly."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jun 03, 2019 3:57 pm    Post subject: Reply with quote

ms - How To Modify Printer Settings with the DocumentProperties() Function

"This article explains how to modify the contents of a DEVMODE structure
with the DocumentProperties() function."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jun 03, 2019 4:01 pm    Post subject: Reply with quote

cp - Configuring Printer Settings Programmatically

"The usage of DocumentProperties and SetPrinter API functions gives an
opportunity to change the printer settings. But, when using them, I could not
have a stable method of changing settings on all Windows OS versions. Below,
all possible methods of changing printer parameters will be described and also
the solution of how to obtain the stabler behavior for different Windows OS
versions."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jun 03, 2019 4:11 pm    Post subject: Reply with quote

ms - SetDefaultPrinter function

"The SetDefaultPrinter() function sets the printer name of the default printer
for the current user on the local computer"
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Mon Jun 03, 2019 4:41 pm    Post subject: Reply with quote

cboard - How can I set windows printer configuration in c?

"I can't get certain options set which are in the DEVMODE structure.
I set the values in the in the DEVMODE object but my Brother HL-1850 printer
completely ignores them.
I've verified the constants that are used and they are all correct.
I checked the value of the option settings and they are all correct.
I tried calling the VALID_OPTIONS option (code below) after setting all the
options but it made no difference.

It uses Windows functions: DocumentProperties() and SetPrinter()."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jun 03, 2019 4:48 pm    Post subject: Reply with quote

so - Printing on the FILE port with a given output path still shows the 'save as' dialog

"My application uses GDI printing to create postscript files then converted to
PDF. My printer use Ghostscript PDF driver and the FILE port (By the way why
it is named "PDF driver" if it cannot output pdf directly) I specify a file output
path with the DOCINFO struct docInfo.lpszOutput = L"c:\temp_path\{guid}.ps";

Everything works fine. But sporadically the driver prompt the 'save as'
dialog, despite I provided an output filename."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jun 03, 2019 4:56 pm    Post subject: Reply with quote

git - windows-graphics-programming-src/Chapt_17/Printer/Printer.cpp

// "Windows Graphics Programming: Win32 GDI and DirectDraw
// ISBN 0-13-086985-6 //
// //
// Written by Yuan, Feng www.fengyuan.com //
// Copyright (c) 2000 by Hewlett-Packard Company www.hp.com //
// Published by Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com //
// //
// FileName : printer.cpp //
// Description: Printer demo program, Chapter 17 //
// Version : 1.00.000, May 31, 2000 "
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Fri Sep 06, 2019 5:04 pm    Post subject: Reply with quote

so - How to tell when Microsoft Print to PDF printer driver is finished?

"So I'm using the print functions of the Windows API directly (CreateDC(),
StartDoc(), StartPage(), EndPage(), EndDoc(), etc.), and selecting the
Microsoft Print to PDF printer driver."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jan 18, 2021 10:40 pm    Post subject: Reply with quote

Print Directly to a Non-Default Printer in MFC

"In developing an MFC application, it is sometimes useful to programmatically
print (without the print dialog) to a non-default printer such as a network
printer or a secondary printer. To do this, the DEVMODE and DEVNAMES
structures are needed."


see: https://stackoverflow.com/questions/1567167/how-do-i-set-a-specific-printer-for-a-report
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Sat Mar 13, 2021 11:24 am    Post subject: Reply with quote

msdn - CreateDCA function (wingdi.h)

"When you call CreateDC to create the HDC for a printer device, the printer
driver validates the DEVMODE. If the printer driver determines that the
DEVMODE is invalid (that is, printer driver can't convert or consume the
DEVMODE), the printer driver provides a default DEVMODE to create the
HDC for the printer device."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group