Announcement

Collapse
No announcement yet.

Problem with duplex printing

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

  • Problem with duplex printing

    I have a Brother HL-5250DN network printer that is duplex capable, but I haven't been able to get the XPRINT SET DUPLEX command to make the printer print both sides. The XPRINT GET DUPLEX command works perfectly, and I can print on both sides by manually setting duplex printing from the properties button on the printer dialog box. A snippit of the XPRINT code I'm using is:
    Code:
       XPRINT ATTACH CHOOSE
       IF LEN(XPRINT$) = 0 THEN EXIT SUB
        
       XPRINT GET DUPLEX TO xDuplex
       IF xDuplex THEN XPRINT SET DUPLEX %DMDUP_VERTICAL
       XPRINT GET DUPLEX TO xDuplex
       MSGBOX STR$(xDuplex)  '... shows 2
       ....
       ....
    Any suggestions before I submit to PowerBasic Support? And just to be sure, I did check for ERR after XPRINT SET DUPLEX, and it was zero.

  • #2
    Try this

    I have a Brother MFC-9840 CDW. The following code works.

    No error checking, just a quick test.

    Code:
    #Compile Exe
    #Dim All
    
    Function PBMain () As Long
     
        Local nDuplex As Long
        
        XPrint Attach Default, "TEST"
        
        XPrint Set Duplex 2
        
        XPrint "This is side 1"
        XPrint FormFeed
        XPrint "This is side 2"
        
        XPrint FormFeed
        
        XPrint Close
    
    End Function

    Comment


    • #3
      Brian, I tried your code... got two sheets, no duplex. For some reason, maybe the XPRINT SET DUPLEX command is just not compatible with my laser printer.

      Thanks anyway.

      Comment


      • #4
        Originally posted by Charles Dietz View Post
        Brian, I tried your code... got two sheets, no duplex. For some reason, maybe the XPRINT SET DUPLEX command is just not compatible with my laser printer.

        Thanks anyway.

        That sounds like it. I know what I send you works on my printer. I thought, maybe, the drivers would have the same base functionality and could give you something that works.

        Have you checked the Brother site for the latest driver for your printer?

        Comment


        • #5
          Good idea, Brian... I'll do that right now.

          Later: Downloaded the latest drivers... no change
          Last edited by Charles Dietz; 17 Mar 2009, 03:24 PM.

          Comment


          • #6
            Use PCL?

            Originally posted by Charles Dietz View Post
            Good idea, Brian... I'll do that right now.

            Later: Downloaded the latest drivers... no change
            The following also works on my printer...
            Good Luck

            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
                
                [b]XPrint $Esc;"&l1S";  ' PCL command for duplex[/b]
            
                XPrint "This is side 1"
                XPrint FormFeed
                XPrint "This is side 2"
            
                XPrint FormFeed
            
                XPrint Close
            
            End Function
            Oops, I just noticed I didn't comment out the PB Duplex statement. I'll try this again when I get home.
            Last edited by Brian Chirgwin; 18 Mar 2009, 07:18 AM. Reason: Added oops message

            Comment


            • #7
              Stupid question, can you, from another program, call up the print dialog for that program, and specify that you want to duplex print to the printer?

              Also, I have a couple of printers which permit that type of operation, and in none of the programs themselves do I find the option in the print dialog for duplex printing, only Properties of the printer itself is the option present.
              Furcadia, an interesting online MMORPG in which you can create and program your own content.

              Comment


              • #8
                I think that is not so stupid like you say ...

                Normally you set the printer to duplex only when you has a file created somewhere by some else to print ...
                "The trouble with quotes on the Internet is that you can never know if they are genuine." - Abraham Lincoln.

                Comment


                • #9
                  No luck, Brian. In fact, a left arrow + "&11S" + "This is side 1" is printed on the first page, followed by "This is side 2" on the second page. Seems like the PCL esc character was not recognized. I'll try to find out why.

                  Excellent idea, though! I sure do appreciate your help, Brian. Thanks.

                  Comment


                  • #10
                    Colin, Arthur, I'm not sure what you mean. Since my printer is duplex capable, I can manually set the printer for duplex printing by entering properties from the printer dialog box. In fact, I can even set duplex printing as a preference. But what I'm trying to do is to programmably set duplex printing.

                    Comment


                    • #11
                      Fails here too.

                      Originally posted by Charles Dietz View Post
                      No luck, Brian. In fact, a left arrow + "&11S" + "This is side 1" is printed on the first page, followed by "This is side 2" on the second page. Seems like the PCL esc character was not recognized. I'll try to find out why.

                      Excellent idea, though! I sure do appreciate your help, Brian. Thanks.
                      I removed the PB duplex call from the sample I did and it fails on my printer as well. I've tried to get the PCL command to work and I have not succeeded. Not sure what else to try.

                      Comment


                      • #12
                        Did a little search engine work:
                        programmatically set duplex printing basic

                        This one sounds promising.
                        http://www.c-bit.org/frame.ms-faq/Q/828638/EN-US/

                        Quoting something from elsewhere:

                        You can use the DeviceCapabilities API to obtain a list of Paper Bins available for the printer and then set the Printer.PaperBin property to the one you want.
                        Furcadia, an interesting online MMORPG in which you can create and program your own content.

                        Comment


                        • #13
                          Brian, one interesting thing about your pcl code is that the XPRINT CLOSE can be commented out and the printing still happens. The pcl command is evidently being recognized, even though the pcl command, itself, gets printed.

                          I can't think of anything else to try either.

                          Comment


                          • #14
                            Another thread, this time addressing the codes:
                            http://www.sqrug.org/sqr-users/sqrus.../msg00124.html
                            Furcadia, an interesting online MMORPG in which you can create and program your own content.

                            Comment


                            • #15
                              Colin, thanks for your help. I tried both of your suggestions... the first one seemed the most promising. But if I translated the Visual Basic routine correctly, I get the message that the driver does not support setting it from the Windows API.

                              This problem is beginning to seem like a printer driver problem with no solution other than from the Brother Company. Anyway, that's the way I'm going to leave it. But I do want to thank everyone who tried to help. It was appreciated.

                              Comment


                              • #16
                                Well, one of the reasons for that last link seems to be the line:
                                init-string = <27>&l1s
                                That is on that page, while your string seems to be:
                                XPrint $Esc;"&l1S"
                                And from writing my own text editing program in assembler many years ago, CaSe MatTeRs with control strings, ...
                                Furcadia, an interesting online MMORPG in which you can create and program your own content.

                                Comment


                                • #17
                                  Originally posted by Charles Dietz View Post
                                  I have a Brother HL-5250DN network printer that is duplex capable, but I haven't been able to get the XPRINT SET DUPLEX command to make the printer print both sides. The XPRINT GET DUPLEX command works perfectly, and I can print on both sides by manually setting duplex printing from the properties button on the printer dialog box. A snippit of the XPRINT code I'm using is:
                                  Code:
                                     XPRINT ATTACH CHOOSE
                                     IF LEN(XPRINT$) = 0 THEN EXIT SUB
                                      
                                     XPRINT GET DUPLEX TO xDuplex
                                     IF xDuplex THEN XPRINT SET DUPLEX %DMDUP_VERTICAL
                                     XPRINT GET DUPLEX TO xDuplex
                                     MSGBOX STR$(xDuplex)  '... shows 2
                                     ....
                                     ....
                                  Any suggestions before I submit to PowerBasic Support? And just to be sure, I did check for ERR after XPRINT SET DUPLEX, and it was zero.
                                  Hi Charles;

                                  If you manually set your printer for duplex operation and then run:
                                  Code:
                                  XPRINT GET DUPLEX TO xDuplex
                                  Does it return a 2?

                                  Comment


                                  • #18
                                    Walter, yes it does.

                                    Comment


                                    • #19
                                      Charles--

                                      You cannot send raw codes (escape sequences) to a printer with XPRINT. That just isn't the way Windows GDI printing works. Every XPRINT is converted to pixels on the page under construction. No codes are ever sent to the printer, just a complete page of pixels when it is ready.

                                      If the printer does not recognize XPRINT SET DUPLEX, that's a failure of the printer driver, and you need to talk to their tech support.

                                      You might just try sending the escape sequence with LPRINT, and then attach the printer for XPRINT. But even if it works, it's a hack, and may fail later.

                                      Best regards,

                                      Bob Zale
                                      PowerBASIC Inc.

                                      Comment


                                      • #20
                                        Charles, i just found your post.
                                        I have been seeing this with my brother 5250 printer as well.
                                        Seems everything goes well with xprint but no duplex printout.

                                        I figured it was just me doing something wrong because i do not have any experience with gui printing.

                                        Did you get your problem solved.
                                        I have many other brother printers, i will be testing on in the future.
                                        p purvis

                                        Comment

                                        Working...
                                        X