Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Tutorial to SWT for Printing
Tutorial to SWT for Printing [message #462149] Fri, 07 October 2005 10:23 Go to next message
Eclipse UserFriend
Originally posted by: bp.maximuss.dk

Hi

Is there any that know where to find a good tutorial to SWT Printing ??
I have tryed Google but could not really find anything usefull.

Regards

Bjarne
Re: Tutorial to SWT for Printing [message #462151 is a reply to message #462149] Fri, 07 October 2005 10:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi Bjarne,

as far as I am aware there is no such tutorial. There are some useful
snippets though.

I developed a printing library "KPrint" for SWT, which you can get from
http://www.kupzog.de/fkmk_uk/Programming/Downloads/downloads .html

Maybe this helps. You can at least have a look how things are done.

Regards,
Friederich


Bjarne wrote:
> Hi
>
> Is there any that know where to find a good tutorial to SWT Printing ??
> I have tryed Google but could not really find anything usefull.
>
> Regards
>
> Bjarne


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Tutorial to SWT for Printing [message #462152 is a reply to message #462151] Fri, 07 October 2005 10:43 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> I developed a printing library "KPrint" for SWT

from the "flyer" i understand, that your liberary creates a
screen-representation of the stuff to print, but it does not actually
print -- am i right?
i'm still looking for a useful _platform-independent_ print-solution which
really prints to paper.
Re: Tutorial to SWT for Printing [message #462164 is a reply to message #462152] Fri, 07 October 2005 13:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi,

your impression is wrong. You get a print preview first, but you can
print with KPrint on "real paper" with or without preview.

Have a look again.

Regards,
Friederich

arne anka wrote:
>> I developed a printing library "KPrint" for SWT
>
>
> from the "flyer" i understand, that your liberary creates a
> screen-representation of the stuff to print, but it does not actually
> print -- am i right?
> i'm still looking for a useful _platform-independent_ print-solution
> which really prints to paper.


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Tutorial to SWT for Printing [message #462165 is a reply to message #462164] Fri, 07 October 2005 13:45 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> your impression is wrong. You get a print preview first, but you can
> print with KPrint on "real paper" with or without preview.

on all supported platforms (primarily linux/gtk)?
even eclipse/linux-gtk supports no printing because swt does not in a
platform independent way and thus it's simply not done (for several years
now, don't know whom they are waiting for ...)
Re: Tutorial to SWT for Printing [message #462185 is a reply to message #462165] Fri, 07 October 2005 17:30 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
arne anka wrote:

>> your impression is wrong. You get a print preview first, but you can
>> print with KPrint on "real paper" with or without preview.
>
> on all supported platforms (primarily linux/gtk)?
> even eclipse/linux-gtk supports no printing because swt does not in a
> platform independent way and thus it's simply not done (for several years
> now, don't know whom they are waiting for ...)

this blam for eclipse (I like eclipse, but no printing on all platforms ...)
Re: Tutorial to SWT for Printing [message #462189 is a reply to message #462185] Fri, 07 October 2005 16:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Ok, I only tested KPrint on Windows. It is at least platform independent
until it you try to print the preview/document. The print functionality
makes use of the org.eclipse.swt.printing.Printer class. From the api
doc, also this seems to be platform-independent. But from the answer of
Arne Anka this class seems to cause problems of linux?

Well, I would suggest trying it. If you need any help, I am happy to
assist you with KPrint matters.

Regards,
Friederich


snpe wrote:
> arne anka wrote:
>
>
>>>your impression is wrong. You get a print preview first, but you can
>>>print with KPrint on "real paper" with or without preview.
>>
>>on all supported platforms (primarily linux/gtk)?
>>even eclipse/linux-gtk supports no printing because swt does not in a
>>platform independent way and thus it's simply not done (for several years
>>now, don't know whom they are waiting for ...)
>
>
> this blam for eclipse (I like eclipse, but no printing on all platforms ...)


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Tutorial to SWT for Printing [message #462194 is a reply to message #462189] Fri, 07 October 2005 20:42 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Friederich Kupzog wrote:

> Ok, I only tested KPrint on Windows. It is at least platform independent
> until it you try to print the preview/document. The print functionality
> makes use of the org.eclipse.swt.printing.Printer class. From the api
> doc, also this seems to be platform-independent. But from the answer of
> Arne Anka this class seems to cause problems of linux?
>
> Well, I would suggest trying it. If you need any help, I am happy to
> assist you with KPrint matters.
>

i try KPrintExample on linux gtk - 'Seite einrichtung' is fine,
i get preview when click on ok - preview is ok, when click
printer icon nothing happen - when click 'Schlieen' throw exception


Exception in thread "main" java.lang.StackOverflowError
at java.util.HashMap$ValueIterator.<init>(HashMap.java:815)
at java.util.HashMap$ValueIterator.<init>(HashMap.java:815)
at java.util.HashMap.newValueIterator(HashMap.java:838)
at java.util.HashMap$Values.iterator(HashMap.java:901)
at
de.kupzog.ktools.kprint.boxes.PTextStyle.disposeFonts(PTextS tyle.java:72)
at de.kupzog.ktools.kprint.gui.PrintPreview.onClose(PrintPrevie w.java:257)
at
de.kupzog.ktools.kprint.gui.PrintPreview$1.shellClosed(Print Preview.java:82)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:159)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
Re: Tutorial to SWT for Printing [message #462202 is a reply to message #462194] Fri, 07 October 2005 22:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

snpe wrote:
> i try KPrintExample on linux gtk - 'Seite einrichtung' is fine,
> i get preview when click on ok - preview is ok, when click
> printer icon nothing happen

Ok, that sounds like something in the PrintDialog class is not
implemented for Linux. Any comments from "SWT officials"?

Basically, the follwing code is executed and I guess it ends because
"data" is null.


protected void onPrint()
{
PrintDialog dialog = new PrintDialog(guiShell, SWT.BORDER);
PrinterData data = dialog.open();
if (data == null) return;

Printer printer = new Printer(data);
GC gc = new GC(printer);

printer.startPage();
document.draw();
printer.endPage();
printer.endJob();
gc.dispose();
printer.dispose();
}


Regards,
Friederich

--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Tutorial to SWT for Printing [message #462204 is a reply to message #462202] Sat, 08 October 2005 01:51 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Friederich Kupzog wrote:

> PrintDialog dialog = new PrintDialog(guiShell, SWT.BORDER);
> PrinterData data = dialog.open();
> if (data == null) return;


I debug this dialog.open return null on linux gtk

printing doesn't work on linux (I think)

It isn't hard implement - command 'lpstat -a' return
all printer (can be called with Runtime or Program) and
then we have set dialog for all usable printers (and print to file)
print is simple with lpr command
It is possible, too for systems with kde that call kprinter with files
(kprinter will do rest) - I don't know similar program on gnome, but it
exists sure

For you Friederich :

Can you save printer file (ps) in file system temporary dir (with full path)
for example postscriptFileName ?

If yes, then

after PrinterData data=dialog.open

call like this

if (data == null && OS.isLinux()) {
String postscriptFileName = makePostScriptFile();
if (Program.execute("kprinter" + postscriptFileName))
return;
else
... similar program on gtk ....

You tell me how I can save file to postscript and I will try
procedure.I need method makePostScriptFile()

regards
Re: Tutorial to SWT for Printing [message #462206 is a reply to message #462204] Sat, 08 October 2005 01:20 Go to previous messageGo to next message
Toon Geens is currently offline Toon GeensFriend
Messages: 4
Registered: July 2009
Junior Member
This bug has been open for years now:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=24796
Blaming GTK+ for the no-printer support

I'm really looking forward for a work-around

Haris Peco wrote:
> Friederich Kupzog wrote:
>
>
>>PrintDialog dialog = new PrintDialog(guiShell, SWT.BORDER);
>>PrinterData data = dialog.open();
>>if (data == null) return;
>
>
>
> I debug this dialog.open return null on linux gtk
>
> printing doesn't work on linux (I think)
>
> It isn't hard implement - command 'lpstat -a' return
> all printer (can be called with Runtime or Program) and
> then we have set dialog for all usable printers (and print to file)
> print is simple with lpr command
> It is possible, too for systems with kde that call kprinter with files
> (kprinter will do rest) - I don't know similar program on gnome, but it
> exists sure
>
> For you Friederich :
>
> Can you save printer file (ps) in file system temporary dir (with full path)
> for example postscriptFileName ?
>
> If yes, then
>
> after PrinterData data=dialog.open
>
> call like this
>
> if (data == null && OS.isLinux()) {
> String postscriptFileName = makePostScriptFile();
> if (Program.execute("kprinter" + postscriptFileName))
> return;
> else
> ... similar program on gtk ....
>
> You tell me how I can save file to postscript and I will try
> procedure.I need method makePostScriptFile()
>
> regards
Re: Tutorial to SWT for Printing [message #462213 is a reply to message #462206] Sat, 08 October 2005 04:44 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Why gtk+ - all programs in gnome (gtk,kde everywhere) have printing
we need dialog page and redirect to printer , only
it can be lpr, any code from cups , anything
older bug is only bigger blame

please , don't tell 'define external program' , only
(i know this)

Toon Geens wrote:

> This bug has been open for years now:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=24796
> Blaming GTK+ for the no-printer support
Re: Tutorial to SWT for Printing [message #462226 is a reply to message #462204] Sat, 08 October 2005 17:10 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
after all it comes down to create postscript.
the printing-posibilities in linux are manifoldly -- but all (regardless
of cups, lpr, desktop-environmental frontends) are able to put postscript
on paper.
friedrich, is there a way, you extend your library to create postscript
and, maybe, even make an eclipse-plugin providing "printing for linux" (i
e take a configured printing frontend and pipe postscript into) from it?
that would be really great!
i would do it myself but i still don't know enough about eclipse-plugins
:-(

regards
Re: Tutorial to SWT for Printing [message #462228 is a reply to message #462226] Sat, 08 October 2005 21:14 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
arne anka wrote:

> after all it comes down to create postscript.
> the printing-posibilities in linux are manifoldly -- but all (regardless
> of cups, lpr, desktop-environmental frontends) are able to put postscript
> on paper.
> friedrich, is there a way, you extend your library to create postscript
> and, maybe, even make an eclipse-plugin providing "printing for linux" (i
> e take a configured printing frontend and pipe postscript into) from it?
> that would be really great!
> i would do it myself but i still don't know enough about eclipse-plugins
> :-(
>
> regards
postscript standard is standard for printing and it is the best way.
When you create postscript file you can print on every platform and to every
printer - I don't understand eclipse's way - creating internal printer
output and it work on windows only (of course)
Re: Tutorial to SWT for Printing [message #462230 is a reply to message #462228] Sat, 08 October 2005 20:56 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> postscript standard is standard for printing and it is the best way.
> When you create postscript file you can print on every platform and to
> every
> printer -

nope. it wont work under windows without further work (installing
ghostscript).
as far as i remember it works under windows (macos probably too) because
there's only one printingsystem/interaction-interface whilst linux has
several approaches (lpd, cups, kprinter, gnome's own and so on) requiring
the user to install additional software.
but because installation of additional software is required nonetheless,
motif or gtk, i can't see why that would be a hinder.

> I don't understand eclipse's way - creating internal printer
> output and it work on windows only (of course)

as said before, eclipse (or better swt) uses the platform's way to print
-- and linux has several different. but in contrast to windows they're all
open and well documented.
au contraire: windows is the only platform not natively able to print
postscript so it's an evidence of incapacity that eclipse works with an
proprietary solution but not with a open one.
and it's even more an evidence of incapacity that they still are
unwillingly to correct that misstep and adopt a strategy widely used:
printing creates postscript and leaves it to the user to configure a
cappable printer, which would be easely done in a preference-page.
Re: Tutorial to SWT for Printing [message #462232 is a reply to message #462226] Sat, 08 October 2005 21:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

arne anka wrote:
> friedrich, is there a way, you extend your library to create postscript
> and, maybe, even make an eclipse-plugin providing "printing for linux"
> (i e take a configured printing frontend and pipe postscript into) from
> it? that would be really great!

Well, postscript sound for me like a good approach. But I have no idea
how to generate postscript. I come from the Windows world and we seem to
be a bit blind on that eye :) But as far as I understand it is nothing
else than a textual text and object position description, right?
So, for KPrint I would need to know

- how to start/end a page
- how to define page size
- how to print a string in font x size y at postion a,b
- how to draw a line from A to B in width c
- how to draw a bitmap at position x,y.

Can anyone help me with that or point me to a good ps file format
description/tutorial? If it is not too complex, I would do it in my
spare time, if I find some :)

> i would do it myself but i still don't know enough about
> eclipse-plugins :-(
Me neither. Unfortunately.

Regards,
Friederich

--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Tutorial to SWT for Printing [message #462234 is a reply to message #462232] Sun, 09 October 2005 00:09 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Friederich,
Postscript is open format and have good documentation
see this http://partners.adobe.com/public/developer/ps/index_specs.ht ml
There are Windows driver for postscript, too see
http://support.microsoft.com/kb/142057/EN-US/
and there are Adobe Windows PPD drivers
http://www.adobe.com/support/downloads/detail.jsp?ftpID=204

When you have postscript file you can print to postscript capable printer
directly or with postcript-to-printer driver - Unix/Linux do this
ghostscript program convert ps file to printer device file
cups,lprd and another programs are clients only - all print on same way

Friederich Kupzog wrote:
>
> Well, postscript sound for me like a good approach. But I have no idea
> how to generate postscript. I come from the Windows world and we seem to
> be a bit blind on that eye :) But as far as I understand it is nothing
> else than a textual text and object position description, right?
> So, for KPrint I would need to know
>
> - how to start/end a page
> - how to define page size
> - how to print a string in font x size y at postion a,b
> - how to draw a line from A to B in width c
> - how to draw a bitmap at position x,y.
>
> Can anyone help me with that or point me to a good ps file format
> description/tutorial? If it is not too complex, I would do it in my
> spare time, if I find some :)
>
Re: Tutorial to SWT for Printing [message #462249 is a reply to message #462232] Sun, 09 October 2005 18:52 Go to previous messageGo to next message
Ivan Markov is currently offline Ivan MarkovFriend
Messages: 61
Registered: July 2009
Member
Friederich,

> So, for KPrint I would need to know
>
> - how to start/end a page
> - how to define page size
> - how to print a string in font x size y at postion a,b
> - how to draw a line from A to B in width c
> - how to draw a bitmap at position x,y.

If it was *that* simple.. ;)
OK, seriously, the big challenge of doing decent PostScript rendering is to
do the font subsetting and embedding stuff correctly.
You need these because otherwise you have to rely to the Base-14 set of
PostScript fonts (embedded in every PostScript printer).
These are not the best choice because:
- They only cover western alphabets
- You don't get WYSIWYG between printer and screen
Even with the Base-14 set, you have to dig up the *Font Metrics* for these
from the Adobe site (PostScript is adome thingy) and use+embed these in your
code, as GC.getFontMEtrics & GC.stringExtend() have to work or almost
nothing will print correctly.

It is a very interesting topic and I've done something for my SWT/Fox port
in this area, but it is coded in C++

What I would advise you is to:
- Forget about PostScript
- Wait for Cairo to stabilize the PS & PDF backends
- Use Cairo+PDF/PS backend+CUPS to do the printing stuff

Or even better yet:
Wait for official SWT dev to wire SWT to CUPS. SWT's GC on GTK+ is already
wired to Cairo, for the advanced graphics support.


-I


>
> Can anyone help me with that or point me to a good ps file format
> description/tutorial? If it is not too complex, I would do it in my
> spare time, if I find some :)
>
> > i would do it myself but i still don't know enough about
> > eclipse-plugins :-(
> Me neither. Unfortunately.
>
> Regards,
> Friederich
>
> --
> Friederich Kupzog
> Elektronik & Software
> Neusser Str. 5-7
> 50670 K
Re: Tutorial to SWT for Printing [message #462256 is a reply to message #462249] Mon, 10 October 2005 02:00 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Ivan,
Read draft of birt project - they have plan for printing similar my
suggestion.
Cairo will resolve problem for Linux, but what about Mac etc ...
Postscript resolve problem everywhere
Ivan Markov wrote:

> Friederich,
>
>> So, for KPrint I would need to know
>>
>> - how to start/end a page
>> - how to define page size
>> - how to print a string in font x size y at postion a,b
>> - how to draw a line from A to B in width c
>> - how to draw a bitmap at position x,y.
>
> If it was *that* simple.. ;)
> OK, seriously, the big challenge of doing decent PostScript rendering is
> to do the font subsetting and embedding stuff correctly.
> You need these because otherwise you have to rely to the Base-14 set of
> PostScript fonts (embedded in every PostScript printer).
> These are not the best choice because:
> - They only cover western alphabets
> - You don't get WYSIWYG between printer and screen
> Even with the Base-14 set, you have to dig up the *Font Metrics* for these
> from the Adobe site (PostScript is adome thingy) and use+embed these in
> your code, as GC.getFontMEtrics & GC.stringExtend() have to work or almost
> nothing will print correctly.
>
> It is a very interesting topic and I've done something for my SWT/Fox port
> in this area, but it is coded in C++
>
> What I would advise you is to:
> - Forget about PostScript
> - Wait for Cairo to stabilize the PS & PDF backends
> - Use Cairo+PDF/PS backend+CUPS to do the printing stuff
>
> Or even better yet:
> Wait for official SWT dev to wire SWT to CUPS. SWT's GC on GTK+ is already
> wired to Cairo, for the advanced graphics support.
>
>
> -I
>
>
>>
>> Can anyone help me with that or point me to a good ps file format
>> description/tutorial? If it is not too complex, I would do it in my
>> spare time, if I find some :)
>>
>> > i would do it myself but i still don't know enough about
>> > eclipse-plugins :-(
>> Me neither. Unfortunately.
>>
>> Regards,
>> Friederich
>>
>> --
>> Friederich Kupzog
>> Elektronik & Software
>> Neusser Str. 5-7
>> 50670 K
Re: Tutorial to SWT for Printing [message #462260 is a reply to message #462256] Mon, 10 October 2005 03:16 Go to previous messageGo to next message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 489
Registered: July 2009
Senior Member
Haris Peco wrote:
> Ivan,
> Read draft of birt project - they have plan for printing similar my
> suggestion.
> Cairo will resolve problem for Linux, but what about Mac etc ...
> Postscript resolve problem everywhere

As far as I know, printing is already supported natively on OS X using SWT.

- Jeff
Re: Tutorial to SWT for Printing [message #462262 is a reply to message #462206] Mon, 10 October 2005 03:21 Go to previous messageGo to next message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
Toon Geens wrote:
> This bug has been open for years now:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=24796
> Blaming GTK+ for the no-printer support

This thread is a bit out of hand but deserves an update.
I really don't think the PostScript idea is ideal for
Linux, especially since the issues with fonts and text are
non-trivial. I'm at the Boston GNOME summit now and a
lot of work has been on GTK+ printing:

http://live.gnome.org/GtkTeamPrintingBreakout

So, at least there is a clear winner in sight. As
mentioned in the SWT bug, a libgnomeprint implementation is
also a possibility now that it's better -- libgnomeprint
from GNOME 2.8 or newer is probably capable enough for an
SWT implementation to target, but even the libgnomeprint
maintainer advised me to not bother and just support the
new GTK+ API ;)

-Billy
Re: Tutorial to SWT for Printing [message #462265 is a reply to message #462260] Mon, 10 October 2005 05:36 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Jeff Myers wrote:

> Haris Peco wrote:
>> Ivan,
>> Read draft of birt project - they have plan for printing similar my
>> suggestion.
>> Cairo will resolve problem for Linux, but what about Mac etc ...
>> Postscript resolve problem everywhere
>
> As far as I know, printing is already supported natively on OS X using
> SWT.
>
Jeff,
I don't use Mac and I don't know - I talk general case - when one make
postcript support it work on all platforms
- windows users are lazy for download added software (except Microsoft's
software and antivirus :) ) - postcript is de-facto standard for printing
(printer can be postcript native and it is the best printers)
Birt project will make postscirpt for own usage
Peco
Re: Tutorial to SWT for Printing [message #462267 is a reply to message #462262] Mon, 10 October 2005 05:45 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Billy,
OpenOffice project create postscript files (on linux) and
printing is great - i don't know what is a problem with fonts
- printing from OO is great (to postscript file and then to printer)
I set printer on OpenOffice like 'kprinter --stdin' and print open
my KDE printing gui (this is only gui - printing is cups) - all is integrate
i print from mozilla (gtk), OpenOffice (gtk and kde and ...) and every gnome
or kde program and from console (command line), but no from eclipse (I have
to make external program)
If you make printing for every platform different it is too much
unnecessary work and postscript file can be transfer from platform to
platform - i can make ps file on linux and print on windows (if have ppd
driver)
i see bug and i don't blaming gtk+ for printing - it is eclipse blame
(i like eclipse, but this is blame) - every program on my platform have
printing
Peco
Billy Biggs wrote:

> Toon Geens wrote:
>> This bug has been open for years now:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=24796
>> Blaming GTK+ for the no-printer support
>
> This thread is a bit out of hand but deserves an update.
> I really don't think the PostScript idea is ideal for
> Linux, especially since the issues with fonts and text are
> non-trivial. I'm at the Boston GNOME summit now and a
> lot of work has been on GTK+ printing:
>
> http://live.gnome.org/GtkTeamPrintingBreakout
>
> So, at least there is a clear winner in sight. As
> mentioned in the SWT bug, a libgnomeprint implementation is
> also a possibility now that it's better -- libgnomeprint
> from GNOME 2.8 or newer is probably capable enough for an
> SWT implementation to target, but even the libgnomeprint
> maintainer advised me to not bother and just support the
> new GTK+ API ;)
>
> -Billy
Re: Tutorial to SWT for Printing [message #462269 is a reply to message #462249] Mon, 10 October 2005 07:14 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> What I would advise you is to:
> - Forget about PostScript

Postscript is an open approach used succesfully for years (if not decades)
now. i don't think we should forget about it.

> Or even better yet:
> Wait for official SWT dev to wire SWT to CUPS.

waiting for the "official swt" on such a crucial issue has turned out to
be in vain. it ends up with being fed up with hope ad calendas graecas but
no useful solution.
if the guys of swt were able to release 3 major releases for main-platform
like linux (solaris too, btw) without caring for a crucial issue like
printing all the years -- how would we trust them caring for it this time?
i'm pretty sure there's a lot of people creating swt or rcp-application
needing the ability to print and tinkering their own solutions to print --
just because a bunch of ideologically blended ignores the need for a
solution.
read the bug given in one of snpe's postings and you undrstand why i'm
that angry.

to Friedrich:
how do you create your printable right now? i would think you have to
create a printable already which may be easely converted into postscript
-- there are several approaches out there already providing that ability,
i think.
Re: Tutorial to SWT for Printing [message #462271 is a reply to message #462262] Mon, 10 October 2005 07:46 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
using any gnome-stuff will probably require to install a lot of unneeded
gnome-dependencies.
there are a lot of people _not_ using gnome but any other environment
(those using kde usually do not like gnomes laf, those using slim managers
like xfce, icewm, ... would not like to fatten and slow down their system
with a bunch of gnomelibs just because a single facility, printing, then
would work) which would be forced to install software not wanted and not
used.
at least the printing facility has to be excluded from fat gnome into
rather slim gtk without additional gnome-dependencies.
Re: Tutorial to SWT for Printing [message #462275 is a reply to message #462269] Mon, 10 October 2005 09:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

arne anka wrote:
> to Friedrich:
> how do you create your printable right now? i would think you have to
> create a printable already which may be easely converted into
> postscript -- there are several approaches out there already providing
> that ability, i think.

I draw an a GC which was created with the Printer Object as constructor
argument.

Can you point me to some of the approaches you mentioned?

Regards,
Friederich

--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Tutorial to SWT for Printing [message #462277 is a reply to message #462275] Mon, 10 October 2005 10:37 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> Can you point me to some of the approaches you mentioned?
as usually i've seen most of them by looking for an easy way to print from
java at all -- because my intended audience would use rather windows than
any other os i dismissed them all together, trusting in google to find
again if needed ;-)

http://java.sun.com/developer/onlineTraining/Programming/JDC Book/advprint.html
that's what i used (probaly the same idea as you use), i'm still unsure
how it works ;-) and use it for single page only.

http://acg.media.mit.edu/people/fry/explain/postscript/
http://www.geocities.com/SiliconValley/5682/Programming.html and from
there -> http://schmidt.devlib.org/java/libraries-postscript.html

http://www.lightsaber.com/project3PO/java2d-pstext.html <- this sounds
best, but seems to stall since 5 years (but probably still a good
foundation to build on?)

if i remember right there's a project connected to apache providing
creation of postscript, but can't remember the name.

sometimes it looks like java is natively able to produce postscript, but i
could not verify that ...
the last approach i used, because i had to to create multipage documents,
was to create a multipage pdf and send it to an pdf-viewer, but linux and
other *ces too are able to print pdf.

http://www.lowagie.com/iText/
as pdf and ps are related it might be useful.
Re: Tutorial to SWT for Printing [message #462284 is a reply to message #462265] Mon, 10 October 2005 13:21 Go to previous messageGo to next message
Ivan Markov is currently offline Ivan MarkovFriend
Messages: 61
Registered: July 2009
Member
> - windows users are lazy for download added software (except Microsoft's
> software and antivirus :) ) - postcript is de-facto standard for printing
> (printer can be postcript native and it is the best printers)
> Birt project will make postscirpt for own usage

De-facto, my a**
There are non-PostScript printers out there, you sould know that.
And while on Linux always producing PostScript is OK, because
CUPS+GhostScript can convert PostScript to whatever format the printer
supports, this is NOT the solution for Windows. The printing API on Windows
is GDI. Deal with it.

-I

P.S. I don't quite get the "added software" thing, but nevermind.
Re: Tutorial to SWT for Printing [message #462286 is a reply to message #462269] Mon, 10 October 2005 13:29 Go to previous messageGo to next message
Ivan Markov is currently offline Ivan MarkovFriend
Messages: 61
Registered: July 2009
Member
Arne,

> > What I would advise you is to:
> > - Forget about PostScript
>
> Postscript is an open approach used succesfully for years (if not decades)
> now. i don't think we should forget about it.

Please, take a look at Cairo before commenting.
What I'm suggesting to Friedrich is to use PostScript/PDF *indirectly*
through Cairo, because
- Cairo already has these backends, although still unstalbe
- org.eclipse.swt.graphics.GC is already wired to Cairo. Shall I explain
what this means?
- The pain of doing font subsetting & embedding will be avoided - Cairo
should do that for Friedrich

Yes, this may require patches against SWt/GTK+, Cairo or both, but *this* is
the way to create a long-term, reliable printing solution.
Doing yet-another PostScript renderer from Java will take too much time, and
eventually will be superseded by the "real", probably Cairo-based SWT/GTK+
printing solution, when it comes out.

> > Or even better yet:
> > Wait for official SWT dev to wire SWT to CUPS.
>
> waiting for the "official swt" on such a crucial issue has turned out to
> be in vain. it ends up with being fed up with hope ad calendas graecas but
> no useful solution.

I'm in no way affiliated with the regular SWT devs.
But, I dare say I know enough of SWT to feel that the GTK printing support
is nearing. If you have the eyes you'll see - the infrastructure is already
there, although for a different purpose.. Yes, I'm referring again to GC
using Cairo for advanced graphics support.

-I
Re: Tutorial to SWT for Printing [message #462288 is a reply to message #462284] Mon, 10 October 2005 13:33 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> supports, this is NOT the solution for Windows. The printing API on
> Windows
> is GDI. Deal with it.

boy, whenever did you deal with that non-windows, non-mac-user were unable
to print? you were obviously not interested in a solution for user _not_
using windows, so please stay silent if those discuss a way to get a
functionality provided by the windows-port of eclipse already!

if you have read right you would have understood that our issue is
_printing_in_linux_! nobody wants the windows-user to miss the
printing-facility, but we expect to be treated likewise -- and the guys at
swt were for years now unable to provide _any_ meaningful solution to
print, an issue you most likely never noticed.
Re: Tutorial to SWT for Printing [message #462290 is a reply to message #462277] Mon, 10 October 2005 13:43 Go to previous messageGo to next message
Ivan Markov is currently offline Ivan MarkovFriend
Messages: 61
Registered: July 2009
Member
Friedrich,

All the links below fall in one of two categories:
- Java2D used for printing. If you can live with that, OK. Note: the .ps
files generated by Java2D are *huge*. I can explain why, if you are
interested.
- Roll-my-own Java-to-Postscript renderer. Either commercial (no-go for you)
or free, but primitive (PsGr - no font embedding, subsetting, and no *font
metrics*).

If you really want to go for the I'll-do-PostScript-from-Java-myself path,
which I don't recommend, you may need:
- The PS reference manuals (from the Adobe site, can't dig up the links
right now) - you *need* to know what Type1, Type3, Type4 PostScript fonts
are
- This (http://eyegene.ophthy.med.umich.edu/lasi/) is nice, as it shows a
primitive way of embedding (sorta) fonts (I think that's the approach Java2D
uses as well, which results in the gigantic .ps files)
- The printing driver in Qt/X11. Note that this is GPL code - you may be
tainted by looking at it, I don't know..
- This may also be useful:
http://cvs.sourceforge.net/viewcvs.py/swtfox/swt-fox/fox-pat ches/FXDCPrint.cpp?rev=1.10&view=auto

-I

"arne anka" <arne.anka@ginguppin.de> wrote in message
news:op.syfef0ifuyrgnr@komhem...
> > Can you point me to some of the approaches you mentioned?
> as usually i've seen most of them by looking for an easy way to print from
> java at all -- because my intended audience would use rather windows than
> any other os i dismissed them all together, trusting in google to find
> again if needed ;-)
>
>
http://java.sun.com/developer/onlineTraining/Programming/JDC Book/advprint.html
> that's what i used (probaly the same idea as you use), i'm still unsure
> how it works ;-) and use it for single page only.
>
> http://acg.media.mit.edu/people/fry/explain/postscript/
> http://www.geocities.com/SiliconValley/5682/Programming.html and from
> there -> http://schmidt.devlib.org/java/libraries-postscript.html
>
> http://www.lightsaber.com/project3PO/java2d-pstext.html <- this sounds
> best, but seems to stall since 5 years (but probably still a good
> foundation to build on?)
>
> if i remember right there's a project connected to apache providing
> creation of postscript, but can't remember the name.
>
> sometimes it looks like java is natively able to produce postscript, but i
> could not verify that ...
> the last approach i used, because i had to to create multipage documents,
> was to create a multipage pdf and send it to an pdf-viewer, but linux and
> other *ces too are able to print pdf.
>
> http://www.lowagie.com/iText/
> as pdf and ps are related it might be useful.
Re: Tutorial to SWT for Printing [message #462323 is a reply to message #462288] Mon, 10 October 2005 13:57 Go to previous messageGo to next message
Ivan Markov is currently offline Ivan MarkovFriend
Messages: 61
Registered: July 2009
Member
My dear friend,

I'm sorry if I offended you in any way, but this:

<snip>
> - windows users are lazy for download added software (except Microsoft's
> software and antivirus :) ) - postcript is de-facto standard for printing
> (printer can be postcript native and it is the best printers)
> Birt project will make postscirpt for own usage
</snip>

writing of yours sounded to me as if you suggest that PostScript is *the*
printing API on Windows as well.
If this is not what you meant - I'm sorry, I guess it all comes down to the
fact that English is not my mother tongue.. ;)

As for your issue being the _printing_in_linux_, (or you mean, printing in
SWT/GTK+, as SWT/Motif does work with Xprint, kinda) I reassure you, I
perfectly understand that.. ;)

"arne anka" <arne.anka@ginguppin.de> wrote in message
news:op.syfmmvfeuyrgnr@komhem...
> > supports, this is NOT the solution for Windows. The printing API on
> > Windows
> > is GDI. Deal with it.
>
> boy, whenever did you deal with that non-windows, non-mac-user were unable
> to print? you were obviously not interested in a solution for user _not_
> using windows, so please stay silent if those discuss a way to get a
> functionality provided by the windows-port of eclipse already!
>
> if you have read right you would have understood that our issue is
> _printing_in_linux_! nobody wants the windows-user to miss the
> printing-facility, but we expect to be treated likewise -- and the guys at
> swt were for years now unable to provide _any_ meaningful solution to
> print, an issue you most likely never noticed.
Re: Tutorial to SWT for Printing [message #462324 is a reply to message #462323] Mon, 10 October 2005 14:30 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> writing of yours sounded to me as if you suggest that PostScript is *the*
> printing API on Windows as well.

nope. he was referring to the fact that
a) the vast majority of supported platforms support postscript natively --
except windows
b) even for windows-users it's easy to install ghostscript and thus make
their platform able to deal with postscript produced anywhere and send it
to the printer (that was the "download added software" he was speaking
about)

> as SWT/Motif does work with Xprint

right, i forgot about that one.
regarding cairo, i think you now understand why at least i am rather
sceptical concerning a solution in near future -- it never had top
priority before and i'm afraid it will not get there in future.
i rather see a working workaround now than waiting for the
super-acme-outperforms-all-other-solution never coming.
Re: Tutorial to SWT for Printing [message #462326 is a reply to message #462324] Mon, 10 October 2005 14:47 Go to previous messageGo to next message
Ivan Markov is currently offline Ivan MarkovFriend
Messages: 61
Registered: July 2009
Member
"arne anka" <arne.anka@ginguppin.de> wrote in message
news:op.syfo9swquyrgnr@komhem...
> > writing of yours sounded to me as if you suggest that PostScript is
*the*
> > printing API on Windows as well.
>
> nope. he was referring to the fact that
> a) the vast majority of supported platforms support postscript natively --
> except windows
> b) even for windows-users it's easy to install ghostscript and thus make
> their platform able to deal with postscript produced anywhere and send it
> to the printer (that was the "download added software" he was speaking
> about)
> > as SWT/Motif does work with Xprint
>
> right, i forgot about that one.

Whatever. I don't even understand why SWT/Win32 was involved in all of that.

> regarding cairo, i think you now understand why at least i am rather
> sceptical concerning a solution in near future -- it never had top
> priority before and i'm afraid it will not get there in future.
> i rather see a working workaround now than waiting for the
> super-acme-outperforms-all-other-solution never coming.

OK, so it was all about my "wait for official SWT/GTK+ to come up with a
solution".
As for "working workaround now", I think I was pretty clear on the effort
needed to do even half-decent GC-to-PostScript renderer.
Probably the guy's best option is a quick-and-dirty Java2D based solution.

-I
Re: Tutorial to SWT for Printing [message #462384 is a reply to message #462286] Tue, 11 October 2005 19:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi all,

after all that discussion I was able to get a sort of overview over the
problem and possible solutions involving KPrint. Since I am not using
Linux I am personally not effected by the problem "no Eclipse print
support for Linux". However, I would spend some time on it if this
solves a realy big problem - which it seems to be after all that
response in this thread.

Still I am not sure if KPrint is the right "medium" to offer a solution.
My KPrint library is a printing layout tool for programmatically
generated documents. It offers special "design" functionality but at the
same time restricts the user to using the KPrint layout concept. As far
as I can see from other thread contributions the basic problem is that
on Linux it is not implemented to use a SWT GC on a Printer. A solution
to this (using Cairo?) would be a more useful approach than adding PS
export features to KPrint. But in this case, KPrint would have not a lot
to do with the problem any more.

Finally I had a look on the Cairo website but was not able to test any
code. Can anyone tell me how to obtain a library for win32 SWT? Do I
have to compile anything first (huaaaaaaaaaaaa) ?

Well, that is my standpoint at the moment. I will be out of office until
next week.

Kind Regards,
Friederich

Ivan Markov wrote:
> What I'm suggesting to Friedrich is to use PostScript/PDF *indirectly*
> through Cairo, because
> - Cairo already has these backends, although still unstalbe
> - org.eclipse.swt.graphics.GC is already wired to Cairo. Shall I explain
> what this means?
> - The pain of doing font subsetting & embedding will be avoided - Cairo
> should do that for Friedrich



--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Tutorial to SWT for Printing [message #462386 is a reply to message #462384] Tue, 11 October 2005 21:12 Go to previous messageGo to next message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
> Still I am not sure if KPrint is the right "medium" to offer a solution.
> My KPrint library is a printing layout tool for programmatically
> generated documents. It offers special "design" functionality but at the
> same time restricts the user to using the KPrint layout concept. As far
> as I can see from other thread contributions the basic problem is that
> on Linux it is not implemented to use a SWT GC on a Printer. A solution
> to this (using Cairo?) would be a more useful approach than adding PS
> export features to KPrint. But in this case, KPrint would have not a lot
> to do with the problem any more.

I don't think this is the right approach. The PS/PDF output in Cairo
isn't really ready yet (but soon, lots of work happened on the weekend),
and the work involved in hacking something through KPrint doesn't really
seem productive. It would be better to either wait for Cairo or hack
up something using libgnomeprint.

-Billy
Re: Tutorial to SWT for Printing [message #462390 is a reply to message #462384] Tue, 11 October 2005 21:20 Go to previous messageGo to next message
Peter Kliem is currently offline Peter KliemFriend
Messages: 35
Registered: July 2009
Member
Haven't tried (but I will if Linux printing won't work):

Draw to an offscreen image using an image gc (calculate size for a whole
page at desired resolution) and output the result using itext (or
other libraries producing pdf or ps). Result: pdf containing the bitmap:
large but printable; rendering using SWT like using printer device on
other platforms -> interchangeable when swt printing is available or
cairo cn be used.

I'll try this one when the problem arises for me.

Best regards

Peter Kliem

Friederich Kupzog wrote:
> Hi all,
>
> after all that discussion I was able to get a sort of overview over the
> problem and possible solutions involving KPrint. Since I am not using
> Linux I am personally not effected by the problem "no Eclipse print
> support for Linux". However, I would spend some time on it if this
> solves a realy big problem - which it seems to be after all that
> response in this thread.
>
> Still I am not sure if KPrint is the right "medium" to offer a solution.
> My KPrint library is a printing layout tool for programmatically
> generated documents. It offers special "design" functionality but at the
> same time restricts the user to using the KPrint layout concept. As far
> as I can see from other thread contributions the basic problem is that
> on Linux it is not implemented to use a SWT GC on a Printer. A solution
> to this (using Cairo?) would be a more useful approach than adding PS
> export features to KPrint. But in this case, KPrint would have not a lot
> to do with the problem any more.
>
> Finally I had a look on the Cairo website but was not able to test any
> code. Can anyone tell me how to obtain a library for win32 SWT? Do I
> have to compile anything first (huaaaaaaaaaaaa) ?
>
> Well, that is my standpoint at the moment. I will be out of office until
> next week.
>
> Kind Regards,
> Friederich
>
> Ivan Markov wrote:
>
>> What I'm suggesting to Friedrich is to use PostScript/PDF *indirectly*
>> through Cairo, because
>> - Cairo already has these backends, although still unstalbe
>> - org.eclipse.swt.graphics.GC is already wired to Cairo. Shall I explain
>> what this means?
>> - The pain of doing font subsetting & embedding will be avoided - Cairo
>> should do that for Friedrich
>
>
>
>
Re: Tutorial to SWT for Printing [message #462392 is a reply to message #462386] Tue, 11 October 2005 23:48 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Billy Biggs wrote:

>
>> Still I am not sure if KPrint is the right "medium" to offer a solution.
>> My KPrint library is a printing layout tool for programmatically
>> generated documents. It offers special "design" functionality but at the
>> same time restricts the user to using the KPrint layout concept. As far
>> as I can see from other thread contributions the basic problem is that
>> on Linux it is not implemented to use a SWT GC on a Printer. A solution
>> to this (using Cairo?) would be a more useful approach than adding PS
>> export features to KPrint. But in this case, KPrint would have not a lot
>> to do with the problem any more.
>
> I don't think this is the right approach. The PS/PDF output in Cairo
> isn't really ready yet (but soon, lots of work happened on the weekend),
> and the work involved in hacking something through KPrint doesn't really
> seem productive. It would be better to either wait for Cairo or hack
> up something using libgnomeprint.
>
> -Billy
it is better do wrong than wait forever (like waiting for linux-eclipse
printing)
Re: Tutorial to SWT for Printing [message #462433 is a reply to message #462386] Wed, 12 October 2005 07:38 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
On Tue, 11 Oct 2005 23:12:34 +0200, Billy Biggs <bbiggs@ca.ibm.com> wrote:
Re: Tutorial to SWT for Printing [message #462435 is a reply to message #462386] Wed, 12 October 2005 07:40 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
> It would be better to either wait for Cairo

could you give a time limit when it would be ready? and when it would be
introduced into eclipse? (wild guessing: not until eclipse 4.x arises)
Re: Tutorial to SWT for Printing [message #462471 is a reply to message #462435] Wed, 12 October 2005 16:58 Go to previous message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
arne anka wrote:
>> It would be better to either wait for Cairo
>
> could you give a time limit when it would be ready? and when it would
> be introduced into eclipse? (wild guessing: not until eclipse 4.x arises)

Finishing the PS/PDF backend of Cairo is planned for Cairo 1.2
(scheduled for 2005-11-01).

http://cvs.cairographics.org/*checkout*/cairo/ROADMAP

This is where most development work is happening right now from the
core Cairo developers.

-Billy
Previous Topic:How to resize widgets?
Next Topic:TextCellEditor - no selection of value when editing
Goto Forum:
  


Current Time: Thu Mar 28 21:25:12 GMT 2024

Powered by FUDForum. Page generated in 0.06573 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top