How to avoid paper ejection after printer.enddoc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gevanand
    New Member
    • Aug 2010
    • 8

    How to avoid paper ejection after printer.enddoc

    Hi buddies,

    I am doing a project in vb6 for a restaurant. They are using continous paper roll of 5" width for billing. They need multi language printing. I tried it with Crystal report and even using printer.print command. As the bill is not having default size, i couldnt set a predefined paper size. When i give printer.enddoc the dotmatrix printer ejects enormous paper. I had searched many sites regarding this. Oops! no use.
    Plese my buddies help me to make it succeed.

    note: my competetor suceeded on this in various projects
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    What type of printer is it?
    Is it possible to find details of the codes that can be send to it?
    I know that on my old-old-old printer (9 pins Star NL-10) it was possible to send control codes for the page length like = [ESC] "C" chr$(0) n .
    Sets page length to n inches.

    Comment

    • gevanand
      New Member
      • Aug 2010
      • 8

      #3
      dear ggeu
      its dotmatrix printer and you cant use escape sequence hence its printer.print command
      thanks for try

      Comment

      • Guido Geurs
        Recognized Expert Contributor
        • Oct 2009
        • 767

        #4
        I have found this in: http://www.bigresource.com

        I don't think you can use the PRINTER object.

        Try opening the PRINTER as a file - with something like OPEN 'LPT1:' AS FILE...

        Then do PRINT #1,CHR$(7)

        I've never tried this on a PC with VB - but that is the way we talked to old-style printers on mainframes.

        Comment

        • gevanand
          New Member
          • Aug 2010
          • 8

          #5
          Dear ggeu
          print # command wont support change of font
          because its DOS style Printing
          I tried it also.
          Thank you again for follow-up

          I tried with bigresource also nobody found a best solution for this.

          Upto my knowledge, whomsoever going to tell the solution for this, will be the first person on net.

          Comment

          • Guido Geurs
            Recognized Expert Contributor
            • Oct 2009
            • 767

            #6
            Do you know the ASCII code for "End of page" for your printer?
            Once we know this, the only problem is the way how we must talk to the printer.

            some say: (http://www.xtremevbtalk.com)

            Well, the "best" way to do this, is to use s.c. Escape characters (defined in the printers manual) and send them to the printer directly. This means, if the printer is attached via LPT port, you send commands to it just like you would print to the plain text file. Something like this:
            Code:
            Open "LPT1" For Output As ...
            Print #1, "Hello!"
            Print #1, Chr$(10) 'line feed
            Close #1
            and if your printer is on COM port, You'd use MSCOMM component to output those same commands.

            As I said, those commands are usualy listed in the printers manual.

            Comment

            • gevanand
              New Member
              • Aug 2010
              • 8

              #7
              Hi ggeu
              I am extremely happy with your intention on my query.
              But I like to inform you that I need different fonts of different columns. Your code I think, wont supports Windows fonts. Please keep in touch on this.

              Comment

              • Guido Geurs
                Recognized Expert Contributor
                • Oct 2009
                • 767

                #8
                Are you using a form print ?
                I have used this for a print in a game.

                Code:
                '§ Send a PRINTSCREEN-Window to the printer
                Private Sub Com_print_Click()
                '§1 Save Print Screen Window in Clipboard
                   On Error GoTo Print_Error
                   Clipboard.Clear
                '§ call the Windows keybd_event sub, passing the built-in
                '§ VB keyboard constant vbKeySnapshot (44) to the sub and 1& for the window catch.
                   keybd_event vbKeySnapshot, 1&, 0&, 0&
                '§ pause to let Windows update the clipboard
                   DoEvents
                '§2 retrieve the clipboard bitmap to the Picture
                  With Picture_print
                      .Picture = Clipboard.GetData(vbCFBitmap)
                '§3 Wake up printer
                      Printer.Print
                '§ print
                      Printer.PaintPicture .Picture, 1000, 1000
                '§ close printer
                      Printer.EndDoc
                   End With
                Exit Sub
                Print_Error:
                   If Err.Number Then MsgBox Err.Description, vbOKOnly, "Printer Error!"
                End Sub
                it's also using Printer.Enddoc !!! but it sets the picture size.

                You can change the form size depending on the lines to print !

                Or is it the command "printer.enddoc " that is misunderstand by the printer.
                If so, do you have the right printerdriver for Windows xx ?

                Comment

                • gevanand
                  New Member
                  • Aug 2010
                  • 8

                  #9
                  any how i got a solution
                  With Win98 printer.print works well.
                  I donna know why its not with windows xp

                  Comment

                  • Guido Geurs
                    Recognized Expert Contributor
                    • Oct 2009
                    • 767

                    #10
                    Maybe the version of the printerdriver (not compatible with XP) ???

                    Comment

                    • gevanand
                      New Member
                      • Aug 2010
                      • 8

                      #11
                      not like that, because i am using in-built driver "EPSON COMPATIBLE 9 PIN" driver in both OS

                      Comment

                      • INFOCARE VENKATESH
                        New Member
                        • Aug 2010
                        • 2

                        #12
                        How to avoid paper ejection after printer.enddoc

                        I have over come this problem,
                        Method 1:
                        You can use Server Properties in the Printer and Faxes Menu in XP to define a custom paper size and call in your report writer. This works 100% for me.

                        Method 2:
                        You should print the bill in text format and redirect it to the printer by the DOS command :TYPE MYBILL.TXT>>PRN .
                        This method is very easy and the print out is faster rather than the windows print. There are also some fonts which prints faster like dos printing. Try those fonts.

                        Bye!!

                        Comment

                        • gevanand
                          New Member
                          • Aug 2010
                          • 8

                          #13
                          Dear Venki
                          Thank you for your msg.
                          But understand me I have to print english and tamil fonts with the bill. so your Text print option wont apply me.
                          Then I am not having fixed length of paper as its roll paper and the print has to end at the end of bill.
                          Plz Help me!

                          Comment

                          • Stewart Ross
                            Recognized Expert Moderator Specialist
                            • Feb 2008
                            • 2545

                            #14
                            Hi Gevanand. I think our posters have made all the suggestions they can to assist you with what is a very unusual request. That you can print using the methods listed to an old 9-pin dot-matrix printer at all is something of a miracle. I note that this is a project you are undertaking - even if we had a complete solution, it would not be in keeping with the spirit of your project for you to keep asking others to solve it for you!

                            -Stewart

                            Comment

                            • gevanand
                              New Member
                              • Aug 2010
                              • 8

                              #15
                              Dear Stewart
                              It works fin with Windows 98SE.
                              But not in XP thats y i am confusing

                              Comment

                              Working...