Announcement

Collapse
No announcement yet.

Multiple xprint render not working

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

  • Multiple xprint render not working

    I need to print a graphic (barcode) on multiple pages. I thought the following code should work, but it only gives me one page. I cannot get it to print more than one page.
    What am I doing wrong?

    Thanks,
    John Tate



    Code:
        
    #PBFORMS CREATED V1.51
    '------------------------------------------------------------------------------
    ' The first line in this file is a PB/Forms metastatement.
    ' It should ALWAYS be the first line of the file. Other
    ' PB/Forms metastatements are placed at the beginning and
    ' end of "Named Blocks" of code that should be edited
    ' with PBForms only. Do not manually edit or delete these
    ' metastatements or PB/Forms will not be able to reread
    ' the file correctly.  See the PB/Forms documentation for
    ' more information.
    ' Named blocks begin like this:    #PBFORMS BEGIN ...
    ' Named blocks end like this:      #PBFORMS END ...
    ' Other PB/Forms metastatements such as:
    '     #PBFORMS DECLARATIONS
    ' are used by PB/Forms to insert additional code.
    ' Feel free to make changes anywhere else in the file.
    '------------------------------------------------------------------------------
    
    #COMPILE EXE
    #DIM ALL
    
    '------------------------------------------------------------------------------
    '   ** Includes **
    '------------------------------------------------------------------------------
    #PBFORMS BEGIN INCLUDES
    #IF NOT %DEF(%WINAPI)
        #INCLUDE "WIN32API.INC"
    #ENDIF
    #PBFORMS END INCLUDES
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Constants **
    '------------------------------------------------------------------------------
    #PBFORMS BEGIN CONSTANTS
    %IDD_DIALOG1  =  101
    %IDC_LABEL1   = 1001
    %IDC_BUTTON1  = 1002
    %IDCANCEL     =    2
    %IDC_TEXTBOX1 = 1003
    %IDC_LABEL2   = 1004
    #PBFORMS END CONSTANTS
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Declarations **
    '------------------------------------------------------------------------------
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    '------------------------------------------------------------------------------
    DECLARE SUB BARCODEPRINT(hDlg AS LONG)
    '------------------------------------------------------------------------------
    '   ** Main Application Entry Point **
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
        ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** CallBacks **
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
                ' Initialization handler
             CONTROL SET TEXT CBHNDL, %IDC_LABEL1,"PLACE HALF SHEETS IN PRINTER" +$CRLF+"MAKER SURE BARCODE WILL PRINT ON PRINTED SIDE"
             CONTROL SET FOCUS CBHNDL, %idc_textbox1
            CASE %WM_NCACTIVATE
                STATIC hWndSaveFocus AS DWORD
                IF ISFALSE CBWPARAM THEN
                    ' Save control focus
                    hWndSaveFocus = GetFocus()
                ELSEIF hWndSaveFocus THEN
                    ' Restore control focus
                    SetFocus(hWndSaveFocus)
                    hWndSaveFocus = 0
                END IF
    
            CASE %WM_COMMAND
                ' Process control notifications
                SELECT CASE AS LONG CBCTL
                    CASE %IDC_LABEL1
    
                    CASE %IDC_BUTTON1
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                            'xprint attach default
                             barcodeprint(CBHNDL)
                             'xprint close
                             MSGBOX "returned"
                        END IF
    
                    CASE %IDCANCEL
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                            DIALOG END CBHNDL, 0
                        END IF
    
                END SELECT
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Dialogs **
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    
    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
        LOCAL hDlg  AS DWORD
    
        DIALOG NEW hParent, "PRINT BAR CODE ON EXISTING DOCS", 70, 70, 345, 191, _
            TO hDlg
        CONTROL ADD LABEL,   hDlg, %IDC_LABEL1, "Label1", 5, 5, 260, 50
        CONTROL ADD BUTTON,  hDlg, %IDC_BUTTON1, "PRINT BAR CODE", 80, 120, 75, _
            15
        CONTROL ADD BUTTON,  hDlg, %IDCANCEL, "EXIT", 185, 120, 50, 15
        CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX1, "", 140, 60, 40, 13
        CONTROL ADD LABEL,   hDlg, %IDC_LABEL2, "enter number of copies", 35, 60, _
            100, 10
    #PBFORMS END DIALOG
    
        DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
    #PBFORMS END CLEANUP
    
        FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------
    
    SUB BARCODEPRINT(hDlg AS LONG)
        LOCAL tempvar AS STRING
        LOCAL X,Y AS SINGLE
        LOCAL I,numcopies AS LONG
        CONTROL GET TEXT Hdlg,%idc_textbox1 TO tempvar
        numcopies = VAL(tempvar)
         XPRINT ATTACH DEFAULT
         XPRINT SCALE (1,1)-(80,66)
         X = 25:Y = 30
         FOR I = 1 TO numcopies
         XPRINT SET POS (X,Y)
         XPRINT RENDER "rtatebar1.bmp",(x,y)- (x+20,y+ 3)
         XPRINT FORMFEED
         NEXT
         XPRINT CLOSE
        END SUB

  • #2
    Printed 2 bitmap images for me, in the same place on each page. XP, 8.04, Laserjet.

    Comment


    • #3
      Thanks for the reply, Chris.
      The file came to me as a .tif file. I opened it in "paint" and saved it as a .bmp file. The problem occurs with all forms of the .bmp, except when saved as a 24 bit bmp.
      It works now, sort of. When I press the print button, the first page is printed immediately, then there is a long pause, with the page half into the printer, then it spits it out correctly- then the third page prints immediately and then the long pause again. I use this printer to print photos on, and there is no hesitation in printing large files, so I do not think it is a buffer reloading problem.
      I will keep trying some things, but I am pretty well stymied right now.

      John Tate

      Comment


      • #4
        John--

        I tried your program with 2 different printers. Different bitmaps with different resolutions -- Worked perfectly every time.

        You need to look at your printer driver. See if there's a later version with a fix.

        Best of luck!

        Bob Zale
        PowerBASIC Inc.

        Comment


        • #5
          Thanks, Bob.
          I have downloaded one new printer driver for my Canon Pixma 3000. It still did not print any differently.
          I have one more printer, and Epson, to try it on- will see how that works.

          John Tate

          Comment


          • #6
            Ok, I tried it on the Epson, and it spit out the pages as fast as the printer allowed with no hesitation between pages at all.

            Now back to trying to find a printer driver for the Canon.

            Thanks again for the help.

            John Tate

            Comment


            • #7
              Print directly to Printer

              Check the option print directly to printer and not to spool the document first. It may make a difference.
              Warped by the rain, Driven by the snow...

              jimatluv2rescue.com

              Comment

              Working...
              X