Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USER DEFINED PAPER SIZE

Status
Not open for further replies.

premiK

Programmer
Jan 8, 2002
22
CA
I want to print data on a pre-printed paper. it's length is 4.25". so I coded like this

Printer.GetPrinter(Adevice,Adriver,Aport,DeviceHandle);
PixelsInInchX:=GetDeviceCaps(Printer.Handle,LOGPIXELSX);
PixelsInInchY:=GetDeviceCaps(Printer.Handle, LOGPIXELSY);
DevMode:=globallock(DeviceHandle);
with DevMode^ do
begin
dmFields := DM_PAPERSIZE or DM_DEFAULTSOURCE or
DM_PAPERWIDTH or DM_PAPERLENGTH;
dmpapersize:=DMPAPER_USER;
dmPaperWidth :=(PixelsInInchX*8.5);
dmPaperLength:=(PixelsInInchY*4.25); //}1101;
end;
printer.SetPrinter(Adevice,Adriver,Aport,DeviceHandle);

But when I run the program the paper length is 612(dmpaperLength returns 612). So I just try to put values and I got my paper size when I put dmPaperLength with 1100 or 1101. The big problem is I want the value between these two values as 1100.5, but I can't put that value because dmPaperLength is an integer type.
It is a pre-printed paper so I must have that size and I want to use that paper in dotmatrix printer.after I print in one page if I don't give my length as correct value the next page data will not be in proper place.

Any body have any idea??
:^)
 
Hi mate,
I had a heck of a time with paper width setting too but why don't you - if ever you are using qreports- set the paper size to 'custim' and set its length and width (in inches or whatever) and then set your printer paper source (outside Delphi) to 'custom' and retype the same length and width? Solutions are sometimes simple and personally I would not have gone through programatically solving that just like you did (I'm really impressed!!! :)).
Hope I brought you the solution, otherwise : I'm so sorry I'm that dumb
anyway cheers,
BonnScott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top