Hello to all of you,
I am banging my head against the wall for this one
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
Harvey