你用QuickReport的升级版本,对页面控制方面应该能行的.下载地址
http://delphi.mychangshu.com/downfile.asp?ID=380&location=Qr35pd6.exe
呵呵,这都是搜的到.
另外,你可以用Printer对象实现对页张的精确打印,精确度可以到毫米级.不过,这些在针式
打印机上最好表现出来.我曾经用这个打个很小的标签.
以下是设置代码,这也是以前找到的,我改了一下.
unit uPrintPaperSetup;
interface
uses windows,printers,SysUtils;
procedure SetPaperSize(X, Y: Integer);
function TransformX(X: Integer): Integer;
function TransformY(Y: Integer): Integer;
function InitPrinter: Boolean;
implementation
var
RateX, RateY: Integer;
function InitPrinter: Boolean;
begin
Result := Printer.Printers.Count > 0;
RateX := MulDiv(GetDeviceCaps(Printer.Handle, LOGPIXELSX), 1000, 254);
RateY := MulDiv(GetDeviceCaps(Printer.Handle, LOGPIXELSY), 1000, 254);
end;
procedure SetPaperSize(X, Y: Integer);
var
Device, Driver, Port: PChar;
HDMode: THandle;
PDMode: PDevMode;
begin
Device := StrAlloc(cchDeviceName);
Driver := StrAlloc(MAX_PATH);
Port := StrAlloc(32);
try
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, HDMode);
if HDMode <> 0 then
begin
PDMode := GlobalLock(HDMode);
if PDMode <> nil then
begin
with PDMode^do
begin
dmPaperSize := 256;
dmPaperWidth := X;
dmPaperLength := Y;
dmFields := dmFields or DM_PAPERSIZE or DM_PAPERWIDTH or DM_PAPERLENGTH;
GlobalUnlock(HDMode);
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
end;
finally
StrDispose(Device);
StrDispose(Driver);
StrDispose(Port);
end;
end;
function TransformX(X: Integer): Integer;
begin
Result := MulDiv(X, RateX, 1000);
end;
function TransformY(Y: Integer): Integer;
begin
Result := MulDiv(Y, RateY, 1000);
end;
procedure TransformPoint(Point: TPoint);
begin
Point.x := TransformX(Point.x);
Point.y := TransformY(Point.y);
end;
procedure TransformRect(Rect: TRect);
begin
Rect.Left := TransformX(Rect.Left);
Rect.Right := TransformX(Rect.Right);
Rect.Top := TransformY(Rect.Top);
Rect.Bottom := TransformY(Rect.Bottom);
end;
end.
调用:
if not InitPrinter then
begin
Application.MessageBox('', '', mb_IconError + mb_OK);
abort;
end;
else
SetPaperSize(500, 300);//设置纸张大小为宽5厘米,高3厘米,够小了吧.
printer.begin
Doc;
Printer.Canvas.Font.Size:=8;
Printer.Canvas.TextOut(TransformX(100),TransformY(150),'1. Hello');
printer.NewPage;//分页
Printer.Canvas.Font.size:=8;
Printer.Canvas.TextOut(TransformX(100),TransformY(150),'2. Hello');
printer.EndDoc;