[問題] C++ 如何更變印表機預設紙張大小
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++
我試著在createDC裡面丟DEVMODE來設定大小
但印出來的紙張長度還是跟預設的一樣
這個試了好幾天了還是沒用
跪求大神幫忙解難題
程式碼(Code):(請善用置底文網頁, 記得排版)
#include<windows.h>
#include<Wingdi.h>
#include<Winspool.h>
#include<iostream>
using namespace std;
前頭有引入https://support.microsoft.com/en-us/kb/167345的子集合
int main(){
SetDefaultPrinter("NEC Pinwriter P2200");
HANDLE gPrinter;
OpenPrinter("NEC Pinwriter P2200",&gPrinter,NULL);
DOCINFO kk={0};
kk.cbSize=sizeof(DOCINFO);
kk.lpszDocName="報表";
kk.lpszOutput="";
kk.fwType=0;
HDC gHDC=0;
gHDC = CreateDC(
NULL,
"NEC Pinwriter P2200",
NULL,
GetLandscapeDevMode((HWND)gPrinter,"NEC Pinwriter P2200")
);
StartDoc(gHDC,&kk);
StartPage(gHDC);
HFONT hFont;
hFont=CreateFont(30,0,0,0,FW_BOLD,0,0,0,0,0,0,2,0,"SYSTEM_FIXED_FONT");
SelectObject(gHDC,hFont);
TextOut(gHDC,300,63,"中文",4);
EndPage(gHDC);
EndDoc(gHDC);
system("PAUSE");
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 124.218.65.102
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1450705253.A.A9D.html
→
12/21 23:27, , 1F
12/21 23:27, 1F
推
12/22 00:02, , 2F
12/22 00:02, 2F
→
12/22 10:25, , 3F
12/22 10:25, 3F
→
12/22 10:25, , 4F
12/22 10:25, 4F
→
12/22 10:27, , 5F
12/22 10:27, 5F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章