Originally posted by: Priyesh
My application should get a notification while printing is done from any application like outlook,word,ie etc....
Is it possible to get a notification when each page printed on the physical printer????
Reply
Originally posted by: venu
i need to change these 4 settings thr program and when execute my prograam, it has to print directly the txt file ...
1)printer (when more than one exists, bydefault itselects one)
hello mydear helpers,
This is venu.
I'm facing a problem in order to write a program, which will set the printer setting programatically.
I downloaded the code given here, but problem with this is , when i am executing the program throu VC++, itz displaying a printer window, which the enduser has to set the things manually, but i need them to be done programatically, and that window shd not open....
2)no of pages
3)no of copies
4)Tray settings i.e., (letter , legal, A4size..)
Thanking you,
venu.
Originally posted by: Jeffrey Fann
Hi
I am having a problem printing multiple copies of a custom print function I wrote.
Basically I want a printout when my function is called, no user interface. I can get
a single printout, but not multiple copies. Also I can get multiple copies if I bring
up the print dialog which I don't want to do. Here is my code... Any suggesstions thanks!
void CWettestView::OnTestResults_Print2()
{
CDC dc;
CPrintDialog printDlg(FALSE);
//DONT WANT TO BRING UP THE DIALOG
//if (printDlg.DoModal() == IDCANCEL) // Get printer settings from user
//return;
CPrintInfo Info;
//THOUGHT THIS LINE WOULD WORK. HAS BEEN BEFORE AND AFTER GET DEFAULTS
Info.m_pPD->m_pd.nCopies=3;
printDlg.GetDefaults();
dc.Attach(printDlg.GetPrinterDC()); // Attach a printer DC
dc.m_bPrinting = TRUE;
DOCINFO di; // Initialise print document details
::ZeroMemory (&di, sizeof (DOCINFO));
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = _T("TEST");
BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job
// Get the printing extents and store in the m_rectDraw field of a
// CPrintInfo object
Info.m_rectDraw.SetRect(0,0,
dc.GetDeviceCaps(HORZRES),
dc.GetDeviceCaps(VERTRES));
dc.StartPage(); // begin new page
dc.TextOut(0,0, "TEST BLAH");
bPrintingOK = (dc.EndPage() > 0); // end page
dc.EndDoc(); // end a print job
dc.Detach(); // detach the printer DC
}
Originally posted by: Neil Devlin
The application Ive written works great when using my cannon printer and epson printer.
But when I select the HP Laserjet 1100 or HP OfficeJet Pro 1150C the application crashes.
The strange thing is , when debugging the application, is a few lines after the printer is restored to the original default!!
anyone any ideas?
cheers
Neil
Originally posted by: kyle
How can i query information of my current printer's trays?
ReplyOriginally posted by: Franz Brunner
Thanks to Joel Matthias who told me there is an
bug in the second constructor. It will never
call the default constructor as intended.
Here is how to correct the code:
First throw out the seconde constructor in
printerettings.h.
Modify the default constructor.
It should then read like this:
class CPrinterSettings : public CObject
{
public:
// default construction
CPrinterSettings(const CString dirname = "");
// copy construction
CPrinterSettings(const CPrinterSettings& cp);
virtual ~CPrinterSettings();
// for use e.g. in CArray
....
In printersettings.cpp do the following modification:
Throw out the implementation of the second constructor.
Modify the default constructor as follows:
// default construction
CPrinterSettings::CPrinterSettings(const CString dirname)
{
m_hDevMode = m_hDevNames = NULL;
m_hSaveDevMode = NULL;
m_hSaveDevNames = NULL;
m_strPrinterName = PRINTERNAME_UNDEFINED;
if(dirname.IsEmpty())
m_strdirname = PRINTERSETTINGS_DIRECTORYNAME;
else
m_strdirname = dirname;
}
Originally posted by: Chris S.
Cool stuff, but how can I create a DC, especially without displaying the PrintDialog?
CPrintInfo PrintInfo;
CDC dcPrint;
PrnSetting.SetThisPrinter();
if (ShowDlg)
{
if (PrintInfo.m_pPD->DoModal() == IDOK)
dcPrint.Attach(PrintInfo.m_pPD->GetPrinterDC());
else
...
}
else
{
AfxGetApp()->CreatePrinterDC(dcPrint);
PrintInfo.m_pPD->m_pd.hDC = dcPrint.hDC;
// copy the ID of the new valid handle
}
Problems:
- if PrintDialog is displayed, the stored printer is not the selected one in the printer dropdown.
- AfxGetApp()->CreatePrinterDC returns a valid DC, put there is no information availabe about the output port etc.
I could use
PrintInfo.m_pPD->GetDefaults();
dcPrint.Attach(PrintInfo.m_pPD->GetPrinterDC());
instead, but this returns a DC for printing on the windows default printer, and not for printing on the printer set by PrnSetting.SetThisPrinter()
Any ideas how to create a valid DC for printing on the stored printer supplying information like output port and device name ??
Thanks a lot
Reply
Originally posted by: Harish Aggarwal
If I use a PCL driver for the printer (8000/8100) or 8500, the AfxGetApp()->GetPrinterDeviceDefaults(&pd)fails. If I use PostScript Driver, everything is fine.
It happens to my application as well.
Is there any soultion or any clue to it.
Thanks,
Harish Aggarwal
Reply
Originally posted by: Jeff Briggs
How can I set the number of copies to be printed or find out what it is currently set to?
Originally posted by: Aixiang Yao
How do I change system's default printer settings?
Can anyone help me on this?
My application does printing thorugh OLE call on an automation server which uses default printer settings (we cannot control on the automation server)
What I want to do is to set a default, let the automation server to use it.