自定义纸张打印: (100分)

  • 主题发起人 coolrain2000
  • 开始时间
C

coolrain2000

Unregistered / Unconfirmed
GUEST, unregistred user!
要打印一份报表.length.330mm(大于A4).width 与A4相同
现在的问题是大于A4的那部分无法打印出来.试过很多方法,如下:
1. 用了setpagesize这个函数(论坛上帖的很多的)注:已调用setprinter.
2. 将QuickReport升为3.6.超出部分可以打印出来,但原来对好的套打为位置却自动上移.
3. 已在2000下将自定义纸张大小,并与QuickReport中选择一样.
Width 210. mmLength 330.mm
4. 听说有打印机不可打印区域的问题.我用的是LQ-670K+.用的是2000下自带的驱动.
最终的结果让我很困惑.I Need you help!!!!Thanks.
 
delphi下的报表就是问题多多
我同样的设置在不同的打印机上就会出问题(打印机设置正常)
推荐你使用标准的纸张,最多多出的部分不用
用A3或B4的纸张 做报表,是不怎么专业但至少不出错。
 
自定义报表的格式大小。
不是太懂。你右键qreport看看,设置大小。
 
procedure SetPaperSize(X, Y: Integer);
// 这段代码绝对可用。单位是0.1mm
// A4时 Printer.Pagewidth:=1440; A5时 Printer.Pagewidth:=1049;
// B5时 Printer.Pagewidth:=1290; 16K时 Printer.Pagewidth:=1035;
// lq1600宽行打印机这个值宽度最大为42cm左右, 长度大约2m。
{Question:
How can I change the papersize of my print job?
Answer:
One way to change printer settings at the start
of a print job is to change the printer's devicemode
structure.
See: TDEVMODE in the Delphi 1.02 help file or DEVMODE
in the Delphi 2.01 help file for other settings you can
change (providing the print driver supports the change).
The following example, contains code to change the papersize and
the paper bin that is uses:}
var
Device: array[0..cchDeviceName - 1] of char;
Driver: array[0..Max_Path - 1] of char;
Port: array[0..32] of char;
hDMode: THandle;
PDMode: PDEVMODE;
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
if (x = 0) or (y = 0) then
begin
{Set to legal}
pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
{pDMode^.dmPaperSize := DMPAPER_LEGAL;
changed by wulianmin}
pDMode^.dmPaperSize := DMPAPER_FANFOLD_US;
end
else
begin
{Set to custom size}//要更修改下面三项
pDMode^.dmFields := pDMode^.dmFields or
DM_PAPERSIZE or
DM_PAPERWIDTH or
DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperWidth := x {SomeValueInTenthsOfAMillimeter};
pDMode^.dmPaperLength := y {SomeValueInTenthsOfAMillimeter};
end;
{Set the bin to use}
pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
//以下开始打印
end;
转载供参考
 
C2008:
多谢你的好意,可既然套打,当然无法用标准纸张
huiyue:
多谢参与
yczjs:
你的函数跟我的差不多.我试过了.没用.
我用win2000 professional +Delphi6.0+LQ-670K+
可有其它良策??
 
I am online.!!!!
 
在2000下,以下代码可行,但是9X下这段代码不行,如果在9X下使用这段代码需手工将打印机纸张设置为自定义纸张
var
HmcRep: THmcRep;
procedure Print_Hmc;
implementation
uses
QRPrntr;
{$R *.DFM}
procedure Print_Hmc;
begin
with THmcRep.Create(Application)do
try
with Pagedo
begin
PaperSize:=Custom;
Width:=210;
Length:=330;
end;
Print;
finally
Free;
end;
end;
 

Similar threads

顶部