🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7303

Re: Printing - Escape Sequence

#7303
From: Thomas J.
Date: Wed, 16 Feb 2005 15:04
152 lines
6583 bytes
I tested this. In the first case the windows printer job queue shows a
document with two pages, but in the second case only one page is shown in
the queue. The result is the same. Two pages were printed.
These means that Form Feed ist not the same as NewPage at least not for the
Windows printer queue and maybe also not for the label printer.

    TPrinter* printer = Printer();
    printer->BeginDoc();
    printer->Canvas->TextOut(300, 300, "First page");
    printer->NewPage();
    printer->Canvas->TextOut(400, 400, "Second page");
    printer->EndDoc();

and with escape sequence


    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 {
                char page1[100];
                sprintf(page1, "First page\n");
                if (!WritePrinter(PrnHandle,page1,strlen(page1),&size)) {
                    Application->MessageBox("WritePrinter", "Error", MB_OK);
                } else {
                    WritePrinter(PrnHandle,Help,strlen(Help),&size);
                    sprintf(page1, "Second page\n");
                    WritePrinter(PrnHandle,page1,strlen(page1),&size);
                }
            }

        if (!EndPagePrinter(PrnHandle))
            Application->MessageBox("EndpagePrinter", "Error", MB_OK);
        else if(!EndDocPrinter(PrnHandle))
            Application->MessageBox("EndDoc", "Error", MB_OK);

        ClosePrinter(PrnHandle);
    } else {
        Application->MessageBox("Drucker nicht gefunden", "Error", MB_OK);
    }


"Thomas J." <monathomas@12move.de> schrieb im Newsbeitrag
news:42135c58@newsgroups.borland.com...
> The paperformat is 9cm to 7,5cm. The labels are "endless". On one role are
> 1000 labels.
> The size of the paper (label) is set correct and I if I debug I get the
> correct dimension of the labe in pixel.
>
> One customer wants to have 2 lables together the next customers needs 4
> label together. So each label represnets a page.
>
> Unfortunately NewPage force the printer to create a new job. This I can
see
> on the display of the printer. But of course only one job you can see in
> "windows printer job window". I'm sure that is a bug in the driver of the
> printern and I will again the company why the hell NewPage force a new
> job -> cutter will cut.
>
> > A formfeed for TPrinter() is NewPage().
>
> Thats what I think too. But then the escape sequence will also not the
> solution and the answer form the printer support team is wrong.
>
> > Forget about escape sequences. Use TextOut(X,Y, ...) to make new lines
> > and use NewPage() as formfeed.
>
> That would great if that will not force the cutter. The problem that in
one
> process you have to print 100 item each item with 2 or 3 label.
> One solution is to destroy the cutter and cut by self - but 300 labels -
> forget it.
> The next solution will be that the stupid cutter cut EACH label and
someone
> has to tabe up each pair.
>
> > Here you mixed the raw printer with TPrinter(). That seems a
> > bad idea to me.
>
> That bad idea is also not working ;)
>
> "Hans Galema" <notused@notused.nl> schrieb im Newsbeitrag
> news:421357d5$1@newsgroups.borland.com...
> > Thomas J. wrote:
> >
> > > I want to print labels on a label printer.
> >
> > On what kind of paper ?
> >
> > > And the aim should be to print a
> > > Label A and a Label B. After each second Label the cutter should cut.
> >
> > So not endless with labels glued on it ?
> >
> >  > I
> > > assumes taht each label is a page. So I called NewPage().
> >
> > But then I would assume that every two labels constitute a page.
> >
> >  > But the printer
> > > will create a new job for each call of NewPage
> >
> > No it will not make a new job. Just start on a new page.
> >
> >  > 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.
> >
> > If you want to send an escape sequence than you have to use
> > the printer in raw mode. As far as I know you cannot use TPrinter()
> > for that. A formfeed for TPrinter() is NewPage().
> >
> > > I found out that another way it is possible to send escape sequnces.
> >
> > Forget about escape sequences. Use TextOut(X,Y, ...) to make new lines
> > and use NewPage() as formfeed.
> >
> >
> > >     OpenPrinter(printername, &PrnHandle, NULL);
> > >     if (PrnHandle != NULL) {
> >
> > >        if (StartDocPrinter(PrnHandle,1,(LPSTR)&DocInfo) <= 0)
> > >           Application->MessageBox("StartDocPrinter", "Error", MB_OK);
> >
> > >         printer->EndDoc();
> >
> >
> > Here you mixed the raw printer with TPrinter(). That seems a
> > bad idea to me.
> >
> >
> > >     TPrinter* printer = Printer();
> > >     printer->BeginDoc();
> > >     printer->Canvas->TextOut(300, 300, "First page");
> > >     Escape(printer->Canvas->Handle,
> >
> > You did not show what function Escape() does.
> >
> > Hans.
>
>
Technical Details
Message-ID: <4213613c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <42125903@newsgroups.borland.com> <421348ec@newsgroups.borland.com> <42134c55@newsgroups.borland.com> <421357d5$1@newsgroups.borland.com> <42135c58@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> <42134c55@newsgroups.borland.com> <421357d5$1@newsgroups.borland.com> <42135c58@newsgroups.borland.com>
Subject: Re: Printing - Escape Sequence 
Date: Wed, 16 Feb 2005 16:04:47 +0100
Lines: 154
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: <4213613c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1108566332 217.78.136.170 (16 Feb 2005 07:05:32 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail