r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Printing]

Henrik
4-Sep-2008
[32x2]
Well, I still think postscript should have become more widespread 
than it ended up being. And you can't change my opinion on that. 
:-) I crave standardization. OK, so if postscript was too hardware 
hungry, then a lighter version could have helped, which is why I 
wonder why PDF came so late.
And I think it sucks that Microsoft choose to invent yet another 
printer driver mess, rather than converge with existing systems.
BrianH
4-Sep-2008
[34]
But they did converge with existing systems, in semantic model. XPS 
is not that far off of PDF in semantics.
Henrik
4-Sep-2008
[35x3]
but they are not source compatible, are they?
I guess what I would want for printers, would be like what HTML does 
for webbrowsers.
or perhaps more appropriate, what OpenGL does for displaying 3D graphics 
on screen.
BrianH
4-Sep-2008
[38]
Well, if you are using the OS's facilities for printing you are using 
the API version of the semantics, not necessarily the source. What 
really matters is the semantics - the source is just a generated 
representation.
Graham
4-Sep-2008
[39x2]
Wrapping the windows printing api doesn't help linux users :)
So, we need to continue supporting postscript.
BrianH
4-Sep-2008
[41]
It wouldn't be the wrapping of the Windows API that would help Linux 
users, it would be his initial work on making a Draw-like printing 
dialect. Defining the dialect is a large part of the process of supporting 
printing in REBOL. There will be non-Windows-specific parts of Doc's 
implementation that can be adapted to a general printing model for 
REBOL, one that can have multiple implementations with different 
backends. For that matter, there would need to be at least 3 backends: 
GDI (for Windows), Postscript (for Ghostscript) and PDF (for Mac 
Quartz), with a possible XPS backend as a minor variation on the 
PDF one.
Kaj
7-Sep-2008
[42x2]
So would or wouldn't you advise to go through PDF for printing to 
GhostScript?
I'm very interested in this for both REBOL and Syllable
Dockimbel
8-Sep-2008
[44x12]
First test release of Printer scheme for direct printing on Windows 
platforms : http://softinnov.org/tmp/printer.zip
No docs for now, look at the sample %test-page.r script and at the 
scheme implementation. Input dialect is a subset of Draw dialect.
There's still some glitches and it needs some fine-tuning before 
providing real WYSIWYG results when compared to Draw rendering.
Draw dialect maps very well with Windows drawing API (GDI). It's, 
in most cases, a one to one mapping.
But Draw dialect is really too level for a daily use. A higher level 
dialect with relative positionning and higher level constructs (e.g. 
tables support), like VID or HTML is needed.
I highly recommand the excellent Bullzip free PDF Printer for testing 
: http://www.bullzip.com/download/pdf/BullzipPDFPrinter_5_0_0_609.zip
Example of multiples pages printing :
p: open printer://
insert p 'start-doc

insert p 'start-page
insert p [text "Page 1" 50x50]
insert p 'end-page

insert p 'start-page
insert p [text "Page 2" 50x50]
insert p 'end-page
...
insert p 'end-doc	;-- this one triggers the real printing
close p
Btw, the printer dialect use milimeters as unit for positioning and 
size.
Possible additionnal features :


- Support for preview View window is possible, but requires some 
fine tuning first in Printer scheme, for WYSIWYG support. 


- Support for Windows standard printer dialog window could be added.


- Support for setting page orientation, page copies, etc...could 
be added.
I don't think that I will have time to add all those features, so 
it's left as an exercice for the community ;-).
Last but not least, the usual one-liner : write printer:// [text 
10x10 "Hello World!"] ;-)
Gregg
8-Sep-2008
[56]
Awesome Doc! I thought I had forever gotten away from start-doc/end-doc, 
but I guess old APIs never die. :-)
Graham
9-Sep-2008
[57]
Fantastic!
Dockimbel
9-Sep-2008
[58]
Gregg: I must admit that I missed the good old VB printer object. 
So now, who wants to clone Crystal Reports ? ;-)
Henrik
9-Sep-2008
[59]
I'm unable to test it here, but what about bringing up the printer 
dialog? Does that happen?
Dockimbel
9-Sep-2008
[60x2]
Not currently, but it could be added.
Btw, it's possible to list the available printers using : probe printer/enum
Pavel
9-Sep-2008
[62]
It must be said clearly YOU ARE THE GREAT! thx for this all
Dockimbel
9-Sep-2008
[63]
Thanks but this isn't really such a great piece of code (Windows 
API is doing the real job), even if it fills a gap in REBOL (at least 
for Windows). Btw, in my company, we're using Gab's pdf-maker for 
years now to generate and print all our documents. I made this library 
only because I needed a direct printing solution for a customer and 
I must admit it was a fun work to do.
Pavel
9-Sep-2008
[64]
But this is the merit, everybody could do it (OK almost everybody, 
not me for example), but you did it.  Printing points up dual problem, 
first it is definitely against Cross-platformity, but second if anybody 
intents to work seriously (make real aplications) definitely need 
it.
Dockimbel
9-Sep-2008
[65]
I've looked at the cross-platform aspects of printing. I think that 
it could be possible to add support for PS and PDF generators for 
Unix and OSX printing support. So we could have the same dialect 
to draw on screen and on printers (on all majors platforms).
Henrik
9-Sep-2008
[66x2]
I wish I could integrate this with my own printing system, but it's 
highly postscript oriented.
mine focuses more on the UI side, offering various methods of printing 
postscript. there is also a printer queue system as well as a printer 
server.
Gregg
9-Sep-2008
[68]
who wants to clone Crystal Reports ?
  

We would need a /bloat refinement to do that. :-)
Louis
9-Sep-2008
[69]
http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=crystal-reports.r
Dockimbel
13-Sep-2008
[70x2]
For information, I've successfully tested direct printing in Linux 
and OS X using PostScript format documents and CUPS as backend. I'm 
currently trying to implement a Draw dialect compiler targeting PS. 
Unix and OS X support wasn't needed for my project, but I couldn't 
resist to give it a try ;-).
I know that Geomol has built a PS lib but, unfortunately, it doesn't 
take Draw dialect as input.
Henrik
13-Sep-2008
[72]
now it's getting really interesting :-)
Dockimbel
13-Sep-2008
[73x3]
;-)
le blog de Billaut  : http://billaut.typepad.com/
(oops sorry, wrong window, please ignore my last post)
Henrik
13-Sep-2008
[76]
did you solve the center/right adjustment problem?
Dockimbel
13-Sep-2008
[77]
R2 kerning issue with Draw that you were talking about ?
Henrik
13-Sep-2008
[78]
yes
Dockimbel
13-Sep-2008
[79]
It's out of my scope currently, I didn't yet worked on the (cross-platform) 
preview window (where Draw engine will be used).
Henrik
13-Sep-2008
[80]
ok
Dockimbel
13-Sep-2008
[81]
If Draw has really some issue with kerning, I can't see how we can 
fix that in R2. We'll have to live with an almost-WYSIWYG model. 
If R2 was open-sourced, that would be, of course, different. ;-)