mfc >> how to get the size of the paper selected before any print or print preview

by behzad » Fri, 28 Nov 2003 04:49:45 GMT

Hi,
I need to know the size of paper user has selected in print dlg before he
starts any print job.
I used
CPrintDialog dlg(FALSE)
CDC dc;
dc.Attach(dlg.m_pd.hDC);
int Paperwidth=GetDeviceCaps(dc.m_hDC,HORZSIZE);

But it always returns the same number , which is the width of an A4 paper
regardlesss of the the type of the paper which was selected in print setup.

thanks,
Behzad




mfc >> how to get the size of the paper selected before any print or print preview

by behzad » Fri, 28 Nov 2003 06:05:01 GMT


hi,
It did the job, just one bug. It needed to run print setup one time to work
ok.
It got Ok, when I called a CWinApp::GetPrinterDeviceDefaults(&pd) before
it.

again thanks,
behzad




he
setup.





mfc >> how to get the size of the paper selected before any print or print preview

by behzad » Fri, 28 Nov 2003 06:05:01 GMT

hi,
It did the job, just one bug. It needed to run print setup one time to work
ok.
It got Ok, when I called a CWinApp::GetPrinterDeviceDefaults(&pd) before
it.

again thanks,
behzad




he
setup.




Similar Threads

1. Printing discrepancy between Print Preview and Print

2. Printing - PrintPreview Dialog and Printing on Paper - text is being changed

Good morning,

I have a print routine where I use a "printpreview dialog' control.

The text is perfect

BUT

when I then print the job all the text is completely crazy, a bit like
"wingdings".

Also, I have downloaded a free demo off the web and that demo works
fine (uses printpreview and prints).

Any ideas,

Thankyou

Peter

3. how to print with custom paper size? - CSharp/C#

4. How to force Paper Size when printing

5. MFC print margin and setting paper size

6. print preview bug when printing

I have encountered a bug in print preview:

In my program, data for printing is taken from arrays. When print preview is
invoked or page is printed directly, it is ok, but when user prints from
print preview, any data that was in array is not draw, so only thing printed
is header and footer.
Arrays with data are in the same scope as variables holding header and
footer data.
They do not loose data and they are not reset as I can access them after
print preview.

What could this be?


7. Printing/Print Preview Problem - CSharp/C#

8. Print Preview and Printing

Hello,

I've created a Document which i want to print using the PrintDocument class.
In the document i draw some strings, and lines. When I PrintPreviewing my 
document (using the PrintPreview class) everything is ok, excatly as i draw 
it. but when i'm sending it to the printer, some of the strings and lines are 
setping out of the page's border. Why is that? doesn't print preview suppose 
to preview the exact printing? is it fixable?

Thanks,
Gidi.