[Gambas-user] lpt printer

Leonardo Miliani leonardo at ...1237...
Tue Jan 29 17:31:21 CET 2008


gunartha ha scritto:
> Hi Everybody,
> 
> I have a question about printing data to lpt printer
> If in VB6
> Open "LPT1:" For Output As #1
> Print #1, "NYOMAN GUNARTHA"
> Close #1
> 
> If in gambas how to direct printing to lpt printer like in VB6
> and how to set paper (as bill paper) when end of data, the paper printer no scroll.
> 
> I'm from Bali/Indonesia, I'm sorry about my english not good and may be this problem had asked before
> 
> Thank you very much
> 
> Regards
> Nyoman Gunartha
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 

You could print something directly to the printer by using the console.
Try something like this:
PUBLIC SUB Printing()
DIM hProcess AS Process

  hProcess = SHELL "lpr " & some_text_to_print_in_a_string & " &"
END

Or, maybe, use Printer object (must use gb.qt component) to create a PS
document and then print it.

PUBLIC SUB Printing()
DIM hProcess AS Process

  Printer.Copies = 1
  Printer.Name = ""
  Printer.File = Application.Path & "/name_of_file.ps"
  Draw.Begin(Printer)
  Draw.Foreground = Color.Black
  Draw.Font.Size = 10
  Draw.Text ("Some text to print", 500,500,1000,100, Align.Left)
  Draw.End
  hProcess = SHELL ("lpr " & Application.Path & "/name_of_file.ps" & " &")
END

-- 
Ciao.
Leo.

Web: www.leonardomiliani.com
E-mail: leonardo at ...1237...

Co-fondatore di Gambas-it.org: www.gambas-it.org
(il sito italiano dedicato alla comunità di Gambas)

Scegli software opensource - Choose opensource software




More information about the User mailing list