Results 1 to 3 of 3

Thread: Changing background color of a printer line?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Posts
    16

    Changing background color of a printer line?

    How can I change the background color of a single printed line on a printer? thanks!!!!!!!!!!

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Posts
    16
    bump

  3. #3
    jim mcnamara
    Guest
    Okay. You want an answer.

    One way is to use a Postscript printer and actually build a postscript file that you send directly to the printer itself, bypassing the GDI. You have to know ps syntax.
    You can bypass the GDI by sending the entire ps file via Escape (see Below)

    If you have the printer manual, and there is some kind of control sequence to do what you want (like ESC#P3{u or whatever }
    then you can send the command to the printer like this:
    Code:
    Private Declare Function Escape Lib "gdi32" (ByVal hdc As Long, _
      ByVal nEscape As Long, ByVal nCount As Long, _
      ByVal lpInData As String, lpOutData As Any) As Long
    
    Sub printit()
        Dim myEscapeCode as String
        Dim undoEscapeCode as String
        Dim i
        myEscapeCode = chr(27) & "{RF&}"  " obviously a made up string
        undoEscapeCode = chr(27) & "[someMoreCrudGoesHere}"
        ' assume you want to change line #5
        for x = 1 to 4
             Printer.Print strTextArray(x)
        next x
        Escape Printer.hdc,PASTHRU, 1,myEscapeCode , 0&
        Printer.Print strTextArray(5)
        Escape Printer.hdc,PASTHRU, 1,myEscapeCode , 0&
        For x = 6 to 50
             Printer.Print strTextArray(x)
        next x
        Printer.EndDoc     
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width