Receit- / POS / Printer with VPE 6+

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Re: Receit- / POS / Printer with VPE 6+

Postby IDEAL Software Support » Fri Jan 09, 2015 12:15 pm

Thank you for the update! Does this mean you are printing always a multiple length of an A4 page on the POS printer?
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Receipt- / POS / Printer with VPE 6+

Postby DDTech » Fri Jan 09, 2015 5:01 pm

IDEAL Software Support wrote:Does this mean you are printing always a multiple length of an A4 page on the POS printer?


More or less, yes. In my case, most receipts don't require the full A4 and the printer just uses what is needed. For a 10cm slip only 10cm of paper are being used (plus the additional ~1cm "dead" paper between cutter and print head).

I have prepared a piece of sample-code that does all the basic handling. It's VFP, but I'm sure everone is able to read and understand it. The coding is pretty darn simple.

Code: Select all
   
m.lcDevice      = "EPSON TM-T88IV Receipt"
m.lnVSpacing = 500    && 5cm

with m.oForm2.oVPE

    if .isOpen()
        .closeDoc()
    endif
   
    .openDoc()
    .AutoBreakMode         = AUTO_BREAK_NO_LIMITS
   
    *-- I'm still working with 1/10 of mm
    *-- so all values shown in this sample appear
    *-- to be ten times as big as You might expect them
    .UnitTransformation = VUNIT_FACTOR_MM10
   
    *-- working with a stored printer setup
    *-- alternatively You would set the
    *-- .Device         = m.lcDevice
    .SetupPrinter(<PrinterSetupFileName.prs>,0)   
       
    *-- I'm leaving pageHeight untouched and just
    *-- set .PageWidth to 80mm
    *.PageHeight    = 4000
    .PageWidth      = 800

    *-- then I set the desired margins. As this has
    *-- to be done on a per page basis, an initPage()
    *-- method does this in my classes. But for
    *-- simplicity of the sample, let's duplicate
    *-- that bit of code
    .nLeftMargin      = 40
    .nRightMargin    = .PageWidth - .nLeftMargin
    .nTopMargin      = 0
    .nBottomMargin = .PageHeight       
   
    *-- small header
    .VPEWrite(50, 200, VFREE, VFREE, "Testreport")
    .VPEWrite(50, VBOTTOM, VFREE, VFREE, "PageHeight: "+trans(.pageHeight))
    .VPEWrite(50, VBOTTOM, VFREE, VFREE, "PageWidth: "+trans(.pageWidth))
    .VPEWrite(50, VBOTTOM, VFREE, VFREE, "VPE-Version: "+trans(.VPEVersion))
   
   
    *-- followed by details
    *-- seven sections of 5cm each
    m.lnTop = 0
       
    for m.lnI = 1 to 7

        *-- this checks for available space and if necessary
        *-- breaks onto the next page.
        *-- If You comment this out, the report will end just
        *-- under the line marked "25". The Rest would be
        *-- visible on a vpe or pdf doc but never on paper.
        if m.lnTop + m.lnVSpacing > .nBottomMargin
       
            *-- not enough space for the next section.
            *-- Break onto the next page and continue.
            *--
            *-- Note that I completely ignore the rest
            *-- that would be available on the previous
            *-- page and continue as if this clause would
            *-- not exist.
            .PageBreak

            .nTop              = 0
            .nBottom         = 0

            .PageWidth        = 800
            .nLeftMargin      = 40
            .nRightMargin    = .PageWidth - .nLeftMargin
            .nTopMargin      = 0
            .nBottomMargin = .PageHeight
               
            m.lnTop             = 0
           
        endif
       
        m.lnTop = m.lnTop + m.lnVSpacing
       
        .Line(VLEFTMARGIN, m.lnTop, -300, m.lnTop)
        .Line(.nRightMargin-300, m.lnTop, .nRightMargin, m.lnTop)
        .TextAlignment = ALIGN_CENTER
        .Write(.nLeftMargin+300, lnTop-20, .nRightMargin-300, VFREE, trans(round(m.lnTop/100,2)))
       
    endfor &&* m.lnI = 1 to 7

    .PrintDoc(.F.)
   
    *.WriteDoc("D:\TEMP\Test_Receipt.vpe")
    *.WriteDoc("D:\TEMP\Test_Receipt.pdf")
   
endwith


With all the weird behavior these printers and drivers have to offer, this time their weirdness works for us. While the bigger gap between "25" and the follwing "5" clearly does exist on the vpe and pdf documents, it is not visible on the printout. I can't tell You if the printer truely performs pageBreak and -reset at the current vpe-position or if it is an outcome of the paper conservation strategy, but the result at hand is a 36.5cm long slip with seven evenly spaced sections.

Women and receipt printers are two of the major things, I really do not understand in life, but I'm more than happy if they behave as expected. And In those rare situations I sometimes even do not have to know why.

I wanted to attach the vpe and pdf doc, but I can't find an option for attachments here. I can send them per mail, if You like, but this way others can't see them (not that it would be that stunning).

Kind regards

Frank Dietrich
Last edited by DDTech on Mon Jan 12, 2015 11:58 am, edited 1 time in total.
DDTech
 
Posts: 37
Joined: Mon Oct 26, 2009 11:45 am

Re: Receit- / POS / Printer with VPE 6+

Postby IDEAL Software Support » Mon Jan 12, 2015 11:14 am

Thank you for the detailed reply. We would appreciate if you send the files by e-mail. If any other customer is interested, we will forward them.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Receit- / POS / Printer with VPE 6+

Postby DDTech » Mon Jan 12, 2015 12:03 pm

IDEAL Software Support wrote:Thank you for the detailed reply. We would appreciate if you send the files by e-mail. If any other customer is interested, we will forward them.


OK, I'll send You the docs later.

Also fixed a typo in my post. I forgot an important "not":
While the bigger gap between "25" and the follwing "5" clearly does exist on the vpe and pdf documents, it is not visible on the printout.
DDTech
 
Posts: 37
Joined: Mon Oct 26, 2009 11:45 am

Re: Receit- / POS / Printer with VPE 6+

Postby IDEAL Software Support » Mon Jan 12, 2015 12:06 pm

Ok, thanks.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Receit- / POS / Printer with VPE 6+

Postby DDTech » Tue Jan 13, 2015 12:54 pm

Your server does not like me :(

Final-Recipient: RFC822; support@IdealSoftware.com
Action: failed
Status: 5.7.1
Remote-MTA: DNS; mail.IdealSoftware.com [2a01:4f8:d13:316::2]
Diagnostic-Code: SMTP; 550 5.7.1 <support@IdealSoftware.com>: Recipient address
rejected: Mail appeared to be SPAM or forged. Ask your
Mail/DNS-Administrator to correct HELO and DNS MX
settings or to get removed from DNSBLs; in
rhsbl.ahbl.org
DDTech
 
Posts: 37
Joined: Mon Oct 26, 2009 11:45 am

Re: Receit- / POS / Printer with VPE 6+

Postby IDEAL Software Support » Tue Jan 13, 2015 3:10 pm

Indeed rhsbl.ahbl.org stopped working a few days ago. The problem has been fixed right now.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Receipt- / POS / Printer with VPE 6+

Postby DDTech » Sun Jan 18, 2015 11:35 pm

IDEAL Software Support wrote:Indeed rhsbl.ahbl.org stopped working a few days ago. The problem has been fixed right now.


now it worked, thx.
DDTech
 
Posts: 37
Joined: Mon Oct 26, 2009 11:45 am

Re: Receit- / POS / Printer with VPE 6+

Postby IDEAL Software Support » Mon Jan 19, 2015 10:38 am

Thanks for sending.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Previous

Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 19 guests

cron