Announcement

Collapse
No announcement yet.

lPrint xPrint and escape codes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • lPrint xPrint and escape codes

    Fortunately I found a post from Bob Zale, but unfortunately was at work and bad internet at home to find the whole post, so I have to ask what may have already been answered before.

    If I understand correctly LPrint only affects the following:

    Lprint can send escape codes
    ports such as LPT? but not USB?

    and if I get XPrint then:
    affects ports, but escape codes are not allowed?

    and its all up to the driver if windows or dos??? (or the manufacturer) ???

    I am totally confused cause XPRINT mainly eludes to a window, or a "Host-Specific" (I think I get part of the 2 but not sure)

    Reason I ask is I have a Epson, that I need to position the printing head, and to my knowledge have to send escape codes to make it "Act like a machine" not "Act like a printer" to make it align itself

    DOS days (and Parallel port seem to work fine) but user needs USB port and same alignment...so I am kind of lost. (I think it has to do with GDI and "Just do as I say" alignment)

    is it even possible to send escape codes to a port beyond Parallel? or is it a mix bag of finding the rosetta stone???
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    As I understand it, with LPRINT is a device level operation; you are attaching directly to what windows thinks is a hardware port. Data sent to the device is un-molested by Windows, and is sent in the order you send it. So, when you print a form, you have to start at the top and work your way down.

    XPRINT, on the other hand, attaches to a Windows device via it's *driver*. Windows will translate the commands via the driver. Printing via XPRINT is more "page oriented". That is, you can print to the bottom of the page first, then the top, then the middle. Data is not sent to the printer until you say so, and then it is processed by the print driver to be sent to the device.

    In your case, becuase you must use a USB connected printer, LPRINT is pretty much useless to you. You'll have to use XPRINT, and get familiar with XPRINT SCALE, XPRINT SET POS, and so forth

    Hope this helps
    Real programmers use a magnetized needle and a steady hand

    Comment


    • #3
      Cliff, i have seen post(s) talking about sending escape sequences with xprint
      also. It was in regards to duplex printing. The duplex code that i think is
      perhaps an option in one of the xprint statements was not working, as i recall,
      and the suggestion to use xprint $ec plus the pcl code for duplex
      printing was made.

      This may or may not work. I would say that it is for sure not supported, but
      may work depending on the printer, codes sent, driver settings, driver used,
      etc.
      Client Writeup for the CPA

      buffs.proboards2.com

      Links Page

      Comment


      • #4
        No Fred, you cannot send any ESCAPE codes in an XPRINT operation. Don't bother trying, it will just waste your time. Use the facilities of the XPRINT functions to manipulate the printer. That's the only way it can possibly work reliably.

        What occurred earlier is that a customer with a Brother printer could not enable Duplex operation with XPRINT DUPLEX. If that happens, it is caused by a fault in the Brother device driver, because XPRINT DUPLEX is proven to work correctly.

        I suggested that he might try sending the duplex ESC sequence via LPRINT, but then immediately follow it with XPRINT ATTACH and additional XPRINT functions. This is a hack, but might work temporarily if the device driver doesn't reset it at the XPRINT ATTACH. It is an emergency fix, but might fail any time in the future.

        The real solution is to pester Brother until you get a reliable driver.

        Best regards,

        Bob Zale
        PowerBASIC Inc.

        Comment


        • #5
          Bob, I was referring to the Code snippet from Brian Chirgwin
          Code:
          #Compile Exe
          #Dim All
          
          Function PBMain () As Long
          
              Local nDuplex As Long
          
              XPrint Attach Default, "TEST"
          
              XPrint Set Duplex 2
              'XPrint Get Duplex To nDuplex
              
              XPrint $Esc;"&l1S";  ' PCL command for duplex
          
              XPrint "This is side 1"
              XPrint FormFeed
              XPrint "This is side 2"
          
              XPrint FormFeed
          
              XPrint Close
          
          End Function
          which clearly shows sending and escape sequence via the xprint command.
          I have never used it, dont have any plans to use it, and as I stated it is not supported and may or may not work. Brian said it worked in his case and that's what i was referring to. I do see that he also sent the xprint set duplex 2 in that code.
          Last edited by Fred Buffington; 4 Apr 2009, 08:18 AM.
          Client Writeup for the CPA

          buffs.proboards2.com

          Links Page

          Comment


          • #6
            It sounds like I am mostly SOL unless my printer provides a driver with API to do what I need.

            In my case it is commanding the print-head to particular positions and print a label.

            Sometimes it could be 1 label, sometimes more. So I need to be able to move the print-head to different positions on the paper to print the next label.

            But by the sounds of it, I Must use a parallel port and Lprint, and USB/XPrint is out of the question????

            Well off to the lab to think of another way.....(Anyone seen my Nitro-Glycerin and my lighter??? )
            Engineer's Motto: If it aint broke take it apart and fix it

            "If at 1st you don't succeed... call it version 1.0"

            "Half of Programming is coding"....."The other 90% is DEBUGGING"

            "Document my code????" .... "WHYYY??? do you think they call it CODE? "

            Comment


            • #7
              Fred--

              I can only tell you the truth. If you use XPRINT to send an ESCAPE code, it will not work. Anyone is free to disregard my advice if they wish.

              Best regards,

              Bob Zale
              PowerBASIC Inc.

              Comment


              • #8
                Cliff
                I think a major part of your question has been missed, there should be no difference in printing to a USB port or Serial port or Parallel port printer so long as you are using the appropriate printer driver and not just the default text only driver. You need to do a page layout via XPRINT which the driver will then translate to whatever codes it needs to move the print head to the correct places in whatever order it can handle.
                John

                Comment


                • #9
                  Bob, I never thought it would work, as a matter of fact when i saw the post originally, I said to myself 'you can send pcl escape sequences (that work) ?'.

                  I was still suspicious that it would work. I probably would have tested it without your post but never had any plans of using escape sequences in anything but a test program.

                  Cliff, I've used xprint to make a label printing program that will print labels and allow you to skip labels so that you can use a partially printed sheet of labels.
                  the xprint set pos does a good job.
                  Client Writeup for the CPA

                  buffs.proboards2.com

                  Links Page

                  Comment


                  • #10
                    FWIW, at work we use lots of Zebra label printers that use the ZPL language. The Windows driver for them give me an "out". I can create a ZPL command sequence, then enclose it in "{}" braces. When the driver sees that, it passes the command string to the printer without processing it. Maybe the printer you're using has a similar feature?

                    Also (and this is another hack), you might be able to share the printer, then use NET USE LPTx assign the LPTx port to the share. Then run your program to use the LPT port.
                    Real programmers use a magnetized needle and a steady hand

                    Comment

                    Working...
                    X