Printing under linux

Hello to all of you,

I am banging my head against the wall for this one :frowning:
First of all, I know there is a linux channel but there seems to be very low traffic there…

I want to print reports to different printers and different printer trays without presenting a dialog to the user on every print. The settings should be made once and then be stored in an ini file and every print should be done without user interaction after hitting the ‘print’ button. While this seems not to be an uncommon task it seems not to be possible under linux.

My first approach was: PrinterSetup - doesn’t work under linux… All I get is an empty string.
So there is no easy way to do this.

Next try: I built a settings dialog which I populated via a shell object calling ‘lpstat’. This way I can gather the information needed for printing and save it to my ini file.

Half way done - I thought…

The idea was to print an image file via a shell object calling ‘lpr’ including the options picked before.

With the printer dialog the way is clear (excerpt of my code):

Dim ps As New PrinterSetup Dim rpt As Report sql = "MYSQLSELECTSTATEMENT" rpt = New MyReport rs = ServerDB.AppDB.SQLSelect(sql) If rs = Nil then beep MsgBox "Nothing found" else If ps.PageSetupDialog Then ps.MaxHorizontalResolution=1200 ps.MaxVerticalResolution=1200 dim g as graphics g = OpenPrinterDialog(ps, Nil) If rpt.Run( rs, ps ) Then if g <> Nil then // notcancelled by user //if the report runs successfully rpt.Document.Print(g) //print the report end if End If

But how do I generate an image from my report that I can send to my printer via ‘lpr’ (and hence not showing any dialog)?

Or is there an easier way to go in linux that I did not see?

Can anyone point me in the right direction? I am stuck here…

Thank you

Check this Feedback:

53954 - Printer.SetupString is Empty on Linux

This does not seems to work on Linux.

Yeah, I know that it does not work - for ages, as it seems…

So I wanted to build something linux specific to come around this problem. As I said I am already capable to read all the printer attributes via a shell object.

I need a way to print a report to a file that I can print under linux via a ‘lpr’ shell command.


No need to apologize. All help is greatly appreciated.