1、打印機的分辨率(象素/英寸)
X方向分辨率=GetDeviceCaps(Printer->Handle,LOGPIXELSX);
Y方向分辨率=GetDeviceCaps(Printer->Handle,LOGPIXELSY);
2、打印紙的大小(以象素為單位)
通過Printer的PageWidth和PageHeight屬性可得到可打印范圍的象素數
物理象素數用以下API得到:
寬=GetDeviceCaps(Printer->Handle,PHYSICALWIDTH)
高=GetDeviceCaps(Printer->Handle,PHYSICALHEIGHT)
物理象素數總是比可打印范圍的象素數要大一些(去掉頁邊距等)。
3、打印紙的實際大小(以英寸為單位)
打印紙的實際大小=物理象素數/分辨率;
紙的寬度=(double)(GetDeviceCaps(Printer->Handle,PHYSICALWIDTH)/
GetDeviceCaps(Printer->Handle,LOGPIXELSX));
紙的高度=(double)(GetDeviceCaps(Printer->Handle,PHYSICALHEIGHT)/
GetDeviceCaps(Printer->Handle,LOGPIXELSY));
注:1 inch=2.54 cm