Announcement

Collapse
No announcement yet.

Not all printers work with XPRINT

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

  • Not all printers work with XPRINT

    Bought a HP all-in-one printer model c4385 just over 90
    days ago. Trying to print to a specific area on a standard
    sheet (8 1/2" x 11"). A Epson and a Canon top load
    printers work ok. But, with the HP, in Landscape mode,
    the set pos does not start at default left margin like other
    printers. In Portrait mode, it does not start at(or measure
    from) top margin? The code to work for all printers is
    for left margin is something like:
    x1=71 'left margin
    XL1 = (6.3750*ppiY)-x1

    With HP, it starts printing not at the default left margin of
    71 pixels (.118") for 600 dpi, but from left edge of page.
    Thus, it prints at 6.257" from left margin.

    Other printers start at default left margin, say .118" and
    then print (6.3750-.118) or 6.257+.118=6.3750 from left.

    I'll have to put in my program requirements, that some
    printers (I don't know how many) do not support changing
    margins in text mode, like the HP C4385.

    I don't see any other possible solution?

  • #2
    What code are you using for the alignment? Can you create a sample demonstrating the problem?
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      All printers are not the same, when it comes to margins.

      Many printers have a fixed margin area where the printer can not print to. I wouldn't even call it a margin, its just the printers limitation of how close to the edge of the paper it can print to. This is a physical limitation of the printer. Thats why you need to retrieve the printers actual printable area , before printing and not just the paper size.

      Some printers can print almost right to the edge of the paper.
      Chris Boss
      Computer Workshop
      Developer of "EZGUI"
      http://cwsof.com
      http://twitter.com/EZGUIProGuy

      Comment


      • #4
        See XPRINT GET MARGIN in the help file - and ensure that you don't attempt to set a position outside those boundaries.

        Note - it retrieves the size of the margin, not the actual physical coordinates of the margins. You can also use XPRINT GET SIZE to decide where to print based on these numbers. I have not tried XPRINT GET CLIENT yet.
        Adam Drake
        Drake Software

        Comment


        • #5
          Chris is dead on. If you must print at an exact spot, you need to query the driver for the unprintable area and factor that into your print location.

          For example:
          GetDeviceCaps(gPrnDC, 112)
          GetDeviceCaps(gPrnDC, 113)
          Or the XPrint Get Margin (have not used it myself - yet).

          Even then there are drivers that report incorrectly, as well as paper feed issues, so you really need to be able to configure a fudge factor as well, preferably to allow adjustment in both positive and negative directions.

          For my current printer (HP2015), I have to manually offset left by -.03 inches and manually offset top by +.05 inches.

          Comment


          • #6
            Here is a snippet of code I use.

            XPRINT SET ORIENTATION 2 ' Landscape mode
            XPRINT GET MARGIN TO x1, y1, x2, y2 ' left, top, rgt, bot
            XPRINT GET PPI TO ppiX, ppiY ' both = 600 dpi
            XPRINT FONT "Times New Roman", 8, 1 ' size 8 bold


            YH1 = (5.9375*ppiY)-y1 ' Height position
            XL1 = (.3125*ppiX) rem -x1 ' Left column positon

            XPRINT SET POS (XL1, YH1) ' Position on 8 1/2" x 11" paper to start printing
            XPRINT ACCT ' Print accout number

            ' the client size(printable area) 8" x 10.685"
            ' the page size is 8 1/2" x 11"

            After reading on-line help for HP printer, it says that in text mode some
            margins cannot be changed and there is no fix for the problem.

            So, how would one know what their printer will do? I mean, changing the margin
            should be pretty standard or else the printer is no good to me.
            Last edited by BRENT GARDNER; 16 Dec 2008, 05:13 PM. Reason: alignment

            Comment


            • #7
              So, how would one know what their printer will do? I mean, changing the margin
              should be pretty standard or else the printer is no good to me.
              I have never reset printer margins, ever.

              I just set 'em in code and always use them when calculating the print position.

              e.g
              Code:
              PRINT_X =   LEFT_MARGIN +  DESIRED_INDENT_FROM_MARGIN
              PRINT_Y =   TOP_MARGIN  +  DESIRED_DOWN_FROM_TOP_MARGIN
              i.e, I never print relative to the PHYSICAL page, I always print on a LOGICAL page.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Get Printer Margins

                Here's a small utility that will return the name and margin setting of all printers attached to your network or, hopefully, your PC.

                On my PC printers 1 through 3 are not physical printers and return 0 for the margins.

                Code:
                #COMPILE EXE "Printer Test"
                #DIM ALL
                
                FUNCTION PBMAIN () AS LONG
                
                  LOCAL ix          AS LONG
                  LOCAL LeftM       AS DWORD
                  LOCAL RightM      AS DWORD
                  LOCAL TopM        AS DWORD
                  LOCAL BottomM     AS DWORD
                  
                  LOCAL sPrinters   AS STRING
                  LOCAL Drucker     AS STRING
                  
                  
                  FOR ix = 4 TO PRINTERCOUNT
                    sPrinters = sPrinters & PRINTER$(NAME, ix) & " "
                    Drucker = PRINTER$(NAME, ix)
                    XPRINT ATTACH Drucker
                    XPRINT GET MARGIN TO LeftM, TopM, RightM, BottomM
                    sPrinters = sPrinters & "Left: " & FORMAT$(LeftM) & " Right: " & FORMAT$(RightM) & " Top: " & FORMAT$(TopM) & " Bottom: " & FORMAT$(BottomM) & $CRLF & $CR
                    XPRINT CLOSE
                  NEXT
                
                  ?sPrinters
                
                
                END FUNCTION
                Last edited by Walt Thompson; 17 Dec 2008, 12:35 PM.

                Comment


                • #9
                  Walter,

                  Nice bit of code, except when my HP PHOTOSMART C4380 series is hooked up and turned on, it does not show? The other printers that are not turned on do show?
                  Epson Print monitor C86 series
                  Canon ip1800 series
                  network \\K1L4d5/epson

                  Comment


                  • #10
                    This may be silly, or actually a point to take a look at.

                    How are these printers attached? USB? Serial? Parallel? (GPIB? or other????)

                    Could be an underlying problem overlooked?????
                    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


                    • #11
                      Brent did you use Walter's code unmodified? or did you change the 4 to 1 and try it ?
                      Client Writeup for the CPA

                      buffs.proboards2.com

                      Links Page

                      Comment


                      • #12
                        Fred,

                        Thanks! When changing code to ix = 1 to PRINTERCOUNT
                        It shows all printers in the control panel.

                        Problem! I would like to know what the default printer is?
                        What code do I need to get the default printer's name?

                        Thanks

                        Comment


                        • #13
                          >What code do I need to get the default printer's name

                          The deviously-named Windows' API function "GetDefaultPrinter"
                          Michael Mattias
                          Tal Systems (retired)
                          Port Washington WI USA
                          [email protected]
                          http://www.talsystems.com

                          Comment


                          • #14
                            Improved Printer Utility

                            Here's an improved version of the utility I posted on Dec 17.
                            This version lists the default printer and all other printers attached to the system. I started the PRINTERCOUNT at 4 in order to skip non physical printers.

                            Code:
                            'Find the Default Printer and all system printers
                            
                            #COMPILE EXE "System Printers"
                            #DIM ALL
                            #INCLUDE "Win32Api.inc"
                            
                            FUNCTION PBMAIN () AS LONG
                            
                              LOCAL ix              AS LONG
                              LOCAL LeftM           AS DWORD
                              LOCAL RightM          AS DWORD
                              LOCAL TopM            AS DWORD
                              LOCAL BottomM         AS DWORD
                            
                              LOCAL sPrinters       AS STRING
                              LOCAL Drucker         AS STRING
                              LOCAL HauptDrucker    AS STRING
                            
                            
                              'First find all printers Note: ix should start at 1 unless you need to skip non physical printers.
                              FOR ix = 4 TO PRINTERCOUNT
                                sPrinters = sPrinters & PRINTER$(NAME, ix) & " "
                                Drucker = PRINTER$(NAME, ix)
                                XPRINT ATTACH Drucker
                                XPRINT GET MARGIN TO LeftM, TopM, RightM, BottomM
                                sPrinters = sPrinters & "Left: " & FORMAT$(LeftM) & " Right: " & FORMAT$(RightM) & " Top: " & FORMAT$(TopM) & " Bottom: " & FORMAT$(BottomM) & $CRLF
                               
                                XPRINT CLOSE
                              NEXT ix
                              
                              'Now find the default printer
                               XPRINT ATTACH DEFAULT, ""
                            
                               FOR ix = 4 TO PRINTERCOUNT
                                  HauptDrucker = PRINTER$(NAME, ix)
                                  IF HauptDrucker = XPRINT$ THEN
                                      EXIT FOR
                                  END IF
                               NEXT ix
                            
                               XPRINT CLOSE
                               
                               'Show Default Printer and a list of all system printers.
                               ?"Default Printer: " + $CR + HauptDrucker + " " + FORMAT$(ix) + $CR + $CR + "Printer List: " + $CR + sPrinters
                            
                            END FUNCTION

                            Comment


                            • #15
                              Walter,

                              Thanks! Looks like the XPRINT$ has the name of default printer.

                              After checking user's password, just want to know if default printer is the "HP Photosmart C4380 series", then direct printing to a different print routine designed
                              specifically for the HP series.

                              XPRINT ATTACH DEFAULT
                              DefPrt = XPRINT$
                              ? "DEFAULT PRINTER IS: "+DefPrt
                              XPRINT CLOSE
                              IF TRIM$(DefPrt) = "HP Photosmart C4380 series" THEN
                              PrResult = %IDYES
                              ELSE
                              PrResult = %IDNO
                              END IF

                              Have not checked all printers yet, but looks like it should work.

                              Comment

                              Working...
                              X