Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Tutorial to SWT for Printing
Tutorial to SWT for Printing [message #462149] |
Fri, 07 October 2005 06:23  |
Eclipse User |
|
|
|
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 #462232 is a reply to message #462226] |
Sat, 08 October 2005 17:28   |
Eclipse User |
|
|
|
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] |
Sat, 08 October 2005 20:09   |
Eclipse User |
|
|
|
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 14:52   |
Eclipse User |
|
|
|
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] |
Sun, 09 October 2005 22:00   |
Eclipse User |
|
|
|
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 #462286 is a reply to message #462269] |
Mon, 10 October 2005 09:29   |
Eclipse User |
|
|
|
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 #462290 is a reply to message #462277] |
Mon, 10 October 2005 09:43   |
Eclipse User |
|
|
|
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 09:57   |
Eclipse User |
|
|
|
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 #462471 is a reply to message #462435] |
Wed, 12 October 2005 12:58  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Wed Jul 23 16:59:30 EDT 2025
Powered by FUDForum. Page generated in 0.08143 seconds
|