Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Jun 20, 2019 4:29 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Is it possible dat OpenPrinterDialog does not work on Linux
PostPosted: Fri Nov 27, 2009 6:18 am 
Offline

Joined: Fri Nov 20, 2009 9:31 am
Posts: 23
dim ps As PrinterSetup
dim strps As String

if ps.PageSetupDialog then
strps = ps.SetupString
end if
MsgBox strps

Does nothing
strps = nil

dm odp As OpenPrinterDialog
Class is not existing

Roland


Top
 Profile  
Reply with quote  
 Post subject: Re: Is it possible dat OpenPrinterDialog does not work on Linux
PostPosted: Fri Nov 27, 2009 12:24 pm 
Offline

Joined: Fri Dec 01, 2006 3:09 pm
Posts: 650
Location: Tennessee, USA
I have never written code for Linux; but, I have written code to do reporting to a printers graphics property within RB a number of times.

Try the following code and see how it goes. Compare it to what you posted and you should be able to see where you went off course. OpenPrinterDialog is a function which you invoke and it returns a graphics object to the printer if the Okay button is clicked. If the Cancel button is clicked that graphics object will be nil.

This code has not been tested, but, it should get you on your way.
dim ps As PrinterSetup
dim psString As String
dim g As Graphics

ps = new PrinterSetup
if ps.pageSetupDialog then
psString = ps.setupString
g = openPrinterDialog(p)
if g <> nil then
// your code to output to the printer using the graphics object (g) goes here
else
msgBox "Printer cancelled due to clicking Cancel on printer dialog"
end if
else
msgBox "Printing cancelled due to clicking Cancel on page setup"
end if


Top
 Profile  
Reply with quote  
 Post subject: Re: Is it possible dat OpenPrinterDialog does not work on Linux
PostPosted: Fri Nov 27, 2009 1:40 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 3:53 pm
Posts: 3261
Location: England
The language reference entry for the PrinterSetup Class says
Quote:
The Page Setup dialog is not supported on Linux builds. Calling this function will return False with no dialog presented to the user.

_________________
Steve Garman
Using REALbasic 2008r2 Professional on Windows Vista Ultimate
and REALbasic 2009r5.1 Professional on Linux Ubuntu 9.04 Desktop
and REAL Studio 2010r1 Personal on Linux Ubuntu 9.10 Desktop
Occasional blog


Top
 Profile  
Reply with quote  
 Post subject: Re: Is it possible dat OpenPrinterDialog does not work on Linux
PostPosted: Thu Feb 18, 2010 12:39 pm 
Offline
User avatar

Joined: Tue Jan 26, 2010 1:33 pm
Posts: 32
Location: Nova Scotia, Canada
On a Linux kernel 2.6.30.5 system using CUPS for printing, the OpenPrinterDialog function always returns NIL.

Is this normal behaviour?

Is there a workaround for this?

How do you access the printer with REALBasic Linux?

Regards,
BG

_________________
REALStudio Enterprise 2011r4.1
Linux Mint 11
MS WIn 7 / XP


Top
 Profile  
Reply with quote  
 Post subject: Re: Is it possible dat OpenPrinterDialog does not work on Linux
PostPosted: Mon Feb 22, 2010 4:32 pm 
Offline
User avatar

Joined: Tue Jan 26, 2010 1:33 pm
Posts: 32
Location: Nova Scotia, Canada
Answering my own question. Always dangerous, but...

I'm a total n00b with this, but it appears as though RB running on at least some Linux distributions (I use Slackware, ZenWalk and Linpus Lite), is not able to create the graphics context needed for printing. OpenPrinter() and OpenPrinterDialog() always return NIL, at least on my machines.

So I'm guessing that RB on Linux ain't gonna print directly, no how, no way.

I might want to build the odd app that prints, so what I decided to do was generate PostScript code in a temporary file on the fly and then use Shell.Execute to either print or display it. I know about four PostScript commands, which seems to be enough to produce the type of reports used in business applications.

So far this all seems to work decently well on a straight-up kernel 2.6 install with CUPS and Ghostscript.
Evince (http://projects.gnome.org/evince/) works real nice to preview PostScript.

So far all I've done is a basic customer list report and a proggie to print mailing envelopes on a Samsung ML-2510 laser.

Best,
BG

_________________
REALStudio Enterprise 2011r4.1
Linux Mint 11
MS WIn 7 / XP


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group