Board index » cppbuilder » Get Paper size from TPrinter

Get Paper size from TPrinter


2004-11-22 10:51:57 AM
cppbuilder20
Hi all,
Is there anyway to get the paper size from a TPrinter Object? i.e. A4, A5,
Letter etc.
I know I could get the Physical sizes of the printing device via
GetDeviceCaps(), but that will require me to convert the units to inches and
compare it against a table, and if there is any decimal error, I'll have one
h*ll of nightmare printed on papers....So, is there a way to get the exact
paper size selected in the priter driver, using TPrinter or not?
Regards.
 
 

Re:Get Paper size from TPrinter

Choykw wrote:
Quote
Hi all,
Is there anyway to get the paper size from a TPrinter Object? i.e. A4, A5,
Letter etc.

I know I could get the Physical sizes of the printing device via
GetDeviceCaps(), but that will require me to convert the units to inches and
compare it against a table, and if there is any decimal error, I'll have one
h*ll of nightmare printed on papers....So, is there a way to get the exact
paper size selected in the priter driver, using TPrinter or not?

Regards.


Look at the API functions AdvancedDocumentProperties and
DocumentProperties. The DEVMODE structure intialized by these
functionsa contains the members dmPaperSize and/or dmFormName that
appear to contain the information you need. I have not tried the functions.
HTH,
Danzer