Click to See Complete Forum and Search --> : Getting printer info (printing ENVELOPES)


Randy H
May 17th, 1999, 01:53 AM
I would like to write some code into my application that allows me to print envelopes. The tricky part is figuring out how to set the margins. Some printers feed smaller stock from the center, while others feed from the top or bottom. MSWord has a simple envelope printing option. Is information on how envelopes will be fed stored somewhere in a printer information file?

I am interested in information on how to determine what margins I should use.

Thanks,
Randy

cniquille
May 17th, 1999, 02:19 AM
Normally, you can have all info of the printer with this code.
This exemple retrieve the size font from the printer with the DC

BOOL CMyApp::InitInstance()
{
...

// These 2 statements are needed to give the app the
// default printer information. Without them, the call
// to CreatePrinterDC fails.
PRINTDLG dlg;
GetPrinterDeviceDefaults(&dlg);

CDC dc;
if (0 != CreatePrinterDC(dc))
{
TEXTMETRIC tm;
dc.GetTextMetrics(&tm);
int x = dc.GetDeviceCaps(HORZRES);
int y = dc.GetDeviceCaps(VERTRES);
...
}

...
}


I hope this will help you

Niquille Christian

Randy H
May 17th, 1999, 11:44 AM
Thanks, but that doesn't completely answer my question. The question is: Is there a way to tell the printer you're using a standard envelope so that the printer prints the text in the right place. For example, I have a HP 720C and there is an envelope feed slot that is flush with the outside of the paper feed. On my friend's older HP3, the paper feed centers smaller stock. There must be some way to tell the printer: I am printing on this size stock, you figure out where this active area (the area to print on) will be. I looked last night and in the DEVMODE structure, you can specify what size paper/envelopes you are using. Does the printer then know where the stock will be in its bed?

Does this make sense?

Thanks,
Randy

cniquille
May 18th, 1999, 02:21 AM
I have seen the DEVMODE structure. It normally works, but I have not try to use it.
You can try to change the value of your printer in the setting, then try to take them with the CPrintDialog::GetDevMode() function

Christian Niquille