Article View: borland.public.cppbuilder.nativeapi
Article #7296Re: Printing - Escape Sequence
From: Thomas J.
Date: Wed, 16 Feb 2005 13:35
Date: Wed, 16 Feb 2005 13:35
85 lines
4027 bytes
4027 bytes
The intention is the following:
I want to print labels on a label printer. And the aim should be to print a
Label A and a Label B. After each second Label the cutter should cut. I
assumes taht each label is a page. So I called NewPage(). But the printer
will create a new job for each call of NewPage and for each new job the
cutter willl work. So Label A and Label B are not together anymore. (I want
to print 300 labels).
The label printer company told me to send the esacep sequence F which is
0x00c a form feed. And thats what I try to do for hours and hours.
I found out that another way it is possible to send escape sequnces. But
this is workig without Canvas and acomponent which I'm using fpr printing
Barcode needs a Canvas.
So with the first snippet it is possible to send escape sequence but I
cannot use because of the barcode.
The second snippet force no form feed
----------------------------------------------------------------------------
------------------
1.
OpenPrinter(printername, &PrnHandle, NULL);
if (PrnHandle != NULL) {
DOC_INFO_1 DocInfo;
DocInfo.pDocName = "SessionName";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = "RAW";
if (StartDocPrinter(PrnHandle,1,(LPSTR)&DocInfo) <= 0)
Application->MessageBox("StartDocPrinter", "Error", MB_OK);
else if (StartPagePrinter(PrnHandle) <= 0)
Application->MessageBox("StartPagePrinter", "Error", MB_OK);
else if (!WritePrinter(PrnHandle,Help,strlen(Help),&size))
Application->MessageBox("WritePrinter", "Error", MB_OK);
if (!EndPagePrinter(PrnHandle))
Application->MessageBox("EndpagePrinter", "Error", MB_OK);
else if(!EndDocPrinter(PrnHandle))
Application->MessageBox("EndDoc", "Error", MB_OK);
printer->EndDoc();
ClosePrinter(PrnHandle);
} else {
Application->MessageBox("Cannot find printer", "Error", MB_OK);
}
----------------------------------------------------------------------------
------------------
2.
char Help[1024];
sprintf(Help, "\x00c");
TPrinter* printer = Printer();
printer->BeginDoc();
printer->Canvas->TextOut(300, 300, "First page");
Escape(printer->Canvas->Handle,
PASSTHROUGH,
sizeof(Help),
Help,
NULL);
printer->Canvas->TextOut(400, 400, "Next page");
printer->EndDoc();
Thanks fr your help
"Hans Galema" <notused@notused.nl> schrieb im Newsbeitrag
news:421348ec@newsgroups.borland.com...
> Thomas J. wrote:
>
> > I tried to send escape sequences to the printer,
>
> With wich intention ? To control the printer ?
>
> > but obviously it is not
> > possible to put a esacpe sequnce into the method Canvas->TextOut(.,...,
> > "Line1\nLine2");
>
> > Prntr->Canvas->TextOut(200, 600, "Hallo 1 \n and");
>
> You can put it in and will get a nice graphic for it.
>
> Ahh... you just want to start a new line. Well that is
> done by a new call to TextOut with the right X,Y parameter.
>
> Hans.
Technical Details
Message-ID:
<42134c55@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42125903@newsgroups.borland.com> <421348ec@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bfc9dd83e27dcf9d X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Thomas J." <monathomas@12move.de> Newsgroups: borland.public.cppbuilder.nativeapi References: <42125903@newsgroups.borland.com> <421348ec@newsgroups.borland.com> Subject: Re: Printing - Escape Sequence Date: Wed, 16 Feb 2005 14:35:36 +0100 Lines: 87 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 217.78.136.170 Message-ID: <42134c55@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1108560981 217.78.136.170 (16 Feb 2005 05:36:21 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail