Article View: borland.public.cppbuilder.nativeapi
Article #8814Re: Printing problem to non A4 Paper
From: Eugene
Date: Sat, 18 Sep 2004 09:41
Date: Sat, 18 Sep 2004 09:41
67 lines
2918 bytes
2918 bytes
Well, i found this code :
//-------------------------------------------------------------
void __fastcall TForm1::ChangePaperSize(int PaperSize)
{
char PrinterName[256];
char DriverName[256];
char PortName[256];
THandle hDevMode;
PDEVMODE pDevMode;
Printer()->GetPrinter
(PrinterName,DriverName,PortName,hDevMode);
if(hDevMode)
{
pDevMode = (PDEVMODE)GlobalLock((void*)hDevMode);
if(pDevMode){
pDevMode->dmPaperSize = PaperSize;
GlobalUnlock((void*)hDevMode);
}
GlobalFree((void*)hDevMode);
}
}
It accepts one A5 paper now if i add ChangePaperSize
(DMPAPER_A5); in front of the Printer()->BeginDoc();
But now it does not print!! Why it doesnt print now?
Eugene
"Eugene" <eugene@dmx.de> wrote:
>
>Hi there,
>
>I wrote a small program and it uses this procedure for printing.
>
>Printer()->Title = "PrintOut";
>Printer()->BeginDoc();
>Printer()->Canvas->Font->Size = 10;
>Printer()->Canvas->TextOutA(1600,205,"3887");
>Printer()->Canvas->TextOutA(1500,280,"Adams Hoop");
>Printer()->Canvas->Font->Size = 12;
>Printer()->Canvas->TextOutA(1450,375,Edit1->Text);
>Printer()->Canvas->TextOutA(770,375,"# "+Edit2->Text+" #");
>Printer()->Canvas->TextOutA(1100,480,Edit6->Text);
>Printer()->Canvas->Font->Size = 10;
>Printer()->Canvas->TextOutA(250,525,"+Edit3->Text+" .-
>"+ComboBox1->Text);
>Printer()->Canvas->TextOutA(250,570,Edit4->Text);
>Printer()->Canvas->TextOutA(350,620,Edit5->Text);
>Printer()->Canvas->TextOutA(320,670,IntToStr(Day));
>Printer()->Canvas->TextOutA(430,670,IntToStr(Month));
>Printer()->Canvas->TextOutA(520,670,IntToStr(Year));
>Printer()->EndDoc();
>
>It works great but there is a small problem with it.I'm using
>Lexmark 2380 plus for printing and I'm using A5 papers(210x148
>mm, half of A4 210x297 mm).When i print first document and load
>second paper, it ejects the second paper.Then i load it again
>it accepts.I think it is caused that i can not define the
>default paper to A5.It still takes it as A4.
>So how can i solve it?
>
>
>Eugene
Technical Details
Message-ID:
<414c02cf$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<414bf302$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2caadd0673962b31 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Eugene" <Eugene@nospam.com> Sender: "Eugene" <Eugene@nospam.com> Reply-To: "Eugene" <Eugene@nospam.com> Subject: Re: Printing problem to non A4 Paper Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 195.175.37.55 X-Forwarded-For: 81.215.251.253 References: <414bf302$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <414c02cf$1@newsgroups.borland.com> Date: 18 Sep 2004 02:41:35 -0700 X-Trace: newsgroups.borland.com 1095500495 207.105.83.66 (18 Sep 2004 02:41:35 -0700) Lines: 68 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail