World: r3wp
[Postscript] Emitting Postscript from REBOL
older newer | first last |
Henrik 24-Jun-2008 [1720x2] | hmm... need some examples for that. |
and a new PC. that stupid machine just died. glorious day today. | |
Graham 24-Jun-2008 [1722x3] | setup a HP printer ( eg an old laserjet ) and set the driver to print to a file |
take the printer output and send it directly to the printer if you can .. see what happens | |
My guess is that it doesn't have any PCL engine on boad. | |
Henrik 24-Jun-2008 [1725] | it might not |
Graham 24-Jun-2008 [1726x2] | the HP driver probably takes PCL and creates a bitmap and then sends it to the printer |
as opposed to sending PCL to the printer... well, that is my guess | |
Henrik 24-Jun-2008 [1728] | if anything, perhaps that process is faster |
Graham 24-Jun-2008 [1729] | ghostscript can generate pcl from postscript ... and then you can feed it to the driver |
Geomol 24-Jun-2008 [1730] | There are many printer specific bugs that require a windows printer driver to make postscript printing work properly Bad news for me! I'm working on a new version of a huge application for a customer, and I was about to rebuild their printing in a couple of months. I planned to use the rebol postscript dialect. |
Henrik 24-Jun-2008 [1731x10] | Geomol, I built a printer abstraction system called system-print for my apps. It's not finished, but for what it does it works sort of OK. You can choose printing method via a GUI and it auto-detects Ghostscript and uses it if necessary. |
http://rebol.hmkdesign.dk/files/system-print.png | |
It supports currently print to file, print to LPT, print to Ghostscript, print to screen (as in screenshot), print to ethernet printer and to a custom network printer server made in REBOL for some simple printer sharing. | |
There is also a print queue system, which you can opt to use, if you don't want to print directly. http://rebol.hmkdesign.dk/files/system-print-queue.png | |
you feed a postscript layout through a parser, which fills in dynamic values and then it's run through postscript.r and then it's fed through system-print to the appropriate printing method. | |
the first part can probably be replaced with your own stuff | |
the downside with this system is that I'm still not using straight native windows printing. the good side is that it offers many alternative solutions for printing. | |
it is largely oriented towards use on Win98/XP. | |
I can release the code for you, if you're interested. | |
another advantage is that it's fairly simple to add a new method. it took 20 minutes to add Ghostscript printing via the win32pr driver and when it was added, I could print anything, which is a nice thing about this abstraction. | |
Graham 24-Jun-2008 [1741] | so does using %//prn work any better than using echo?? |
Henrik 25-Jun-2008 [1742] | I don't know. I don't have the HP1200 anymore. :-) |
Anton 14-Oct-2008 [1743] | Can you put images into postscript ? |
Henrik 14-Oct-2008 [1744x2] | yes, jpg, gif, bmp and I believe png is also supported. |
but not image! yet | |
Anton 14-Oct-2008 [1746x3] | Well we can save/bmp |
So you could use save/bmp #{} to-image face | |
for those faces which have DRAW blocks, as a temporary measure. | |
Henrik 14-Oct-2008 [1749x2] | so it saves it as a bmp in memory? |
I was wrong. There is image! support, although this was not brought out in the dialect (strange). Problem is right now that Ghostscript refuses to display postscripts with images from to-postscripts. | |
Anton 14-Oct-2008 [1751x3] | Yes, it saves as a bmp bitmap in the binary specified, so no need for intermediate file. |
Geomol's dialect allows image! but you have to reference it by a word (no direct reference). | |
(Never mind the save/bmp thing.) | |
Geomol 14-Oct-2008 [1754] | :-) Good to see some being done in this area. If you have ideas for the postscript dialect http://home.tiscali.dk/john.niclasen/postscript/postscript.r , let me know. Documentation: http://home.tiscali.dk/john.niclasen/postscript/postscript.html |
Anton 14-Oct-2008 [1755] | Ah docs by the author.. :) |
Geomol 14-Oct-2008 [1756] | Yeah, that's rare, isn't it! ;P |
Anton 14-Oct-2008 [1757x2] | write/binary %test-image.ps postscript [DeviceRGB [translate 10x10 scale 72x72 image help.gif]] |
I can see the help.gif image, in colour, at the bottom of the page, using kghostview. | |
Geomol 14-Oct-2008 [1759] | I can too using Preview under OS X. |
Anton 14-Oct-2008 [1760] | Hmm.. what's the height of the page ? I want to put the image at the top. |
Geomol 14-Oct-2008 [1761x2] | Paper sizes in postscript: A4: 595x842 A5: 420x595 Letter: 612x792 |
You can also use the command "switchy" to switch y-axis. See last command in the docs. | |
Anton 14-Oct-2008 [1763x2] | Aha, that's useful for what Henrik's doing. |
I suppose actually I should ignore the page size. | |
Geomol 14-Oct-2008 [1765x3] | The whole page will be upside down, it seems, also the graphics. That can prob. be fixed with some transformation. |
I think, if you write code, that'll produce postscript output, you have to know the paper size. At least the last step has to know. I see postscript as a language, where you have full control over, what you get on the paper. | |
In contrast to e.g. HTML, where it's up to the browser, how it'll look. | |
Anton 14-Oct-2008 [1768x2] | This talks about page size. |
http://alumni.media.mit.edu/~szummer/postscript/ | |
older newer | first last |