Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

How to print a document

 [1/22] from: fjouen:free at: 11-Jun-2001 22:47


Hi, I've just discovered Rebol and I'm very impressed by this language. However I can't find any information how to print a text document to a printer. Thanks for your help François Jouen Laboratoire de Psychobiologie du Développement EPHE 41 rue Gay Lussac 75005 Paris Tel: 33 (0)1 44 10 78 83 Fax: 33 (0)1 43 26 88 16

 [2/22] from: rsaathoff:datajunction at: 11-Jun-2001 16:30


I'm assuming your using REBOL/view or command/view or view pro. Currently, these do not have a print function. What I usually do is highlight the entire document I want to print, hit ctrl+c to copy, open up notepad (or any other text editor/word processor) and then paste it into a blank document and print that. Hope that helped! ;) Ryan

 [3/22] from: gjones05:mail:orion at: 11-Jun-2001 16:31


From: François Jouen
> Hi, > I've just discovered Rebol and I'm very impressed > by this language.
Yes, it is a neat language.
> However I can't find any information how to print a text > document to a printer. >From windows, you can use:
write %//prn "Hello, World!" or, for larger documents mydoc: {Hello, really big World!} write: %//prn mydoc --Scott Jones

 [4/22] from: fjouen:free at: 12-Jun-2001 9:49


Thanks for your help. This is perfect. Best regards from Paris François François Jouen Laboratoire de Psychobiologie du Développement EPHE 41 rue Gay Lussac 75005 Paris Tel: 33 (0)1 44 10 78 83 Fax: 33 (0)1 43 26 88 16

 [5/22] from: moeller_thorsten:gmx at: 12-Jun-2001 10:25


Hi Scott,fellow Rebolers, i ran into the same problem as Francois a while ago. OK, Rebol is a messaging language per definition, but that should not exclude printing in all environments. I was *NOT* able to get the %//prn stuff to work for me as i don't have an local attached printer. I only have network-printer at my service, but they didn't care about any printing command from my W2K box at all. So what can i do? Telling the users, sorry you can Mail your results anywhere, but printing? No, sorry. And the App has lost before coming to live. Poeple want to print out things today as in the past, necessary or not, regardless what the future will bring. Andrew made a neat little tool for printing, but what does it help with no local printer. OR is it a W2K problem? No, W98, same problem! In many companies there are lots of network-printers, which could be used. I wondered why this is not a problem for other programmers? Any comments out there? Thorsten -----Ursprüngliche Nachricht----- Von: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]Im Auftrag von GS Jones Gesendet: Montag, 11. Juni 2001 23:32 An: [rebol-list--rebol--com] Betreff: [REBOL] Re: How to print a document From: François Jouen
> Hi, > I've just discovered Rebol and I'm very impressed > by this language.
Yes, it is a neat language.
> However I can't find any information how to print a text > document to a printer. >From windows, you can use:
write %//prn "Hello, World!" or, for larger documents mydoc: {Hello, really big World!} write: %//prn mydoc --Scott Jones

 [6/22] from: petr:krenzelok:trz:cz at: 12-Jun-2001 10:44


Hi, so, I know how do you feel. I complained the same some time ago here. Nothing helped, as RT told us there is no easy multiplatform solution to printing. But message to RT - who cares? ;-): 1) some multiplatform issues are already broken (e.g. IF someone will use Mac fs support) 2) strange sound implementation - it is NOT solved in rebol kernel engine itself: ->> ble: open sound:// ** Script Error: Feature not available in this REBOL ** Near: ble: open sound:// ->> error? try [ble: open sound://] == true So, each time you want to open sound port in your script, you have to state above condition, or your app will fail. I don't understand why it is not solved the save way as security box dialog - it just asks for persmission. Maybe it could be solved that way too? If I don't have sound card in my comp, apps using sound capabilities don't probably require special versions :-) I hope that once component system evolves further, these issues will get resolved ... Back to printing - for the time being, you will have to reproduce your forms into html code. It is probably the best solution. It takes some time, but the aproach is repetitive, so you will reuse your solution once done. It is very easy to create html output using Rebol and send it to browser via 'browse function. Every machine out there seems to have browser installed nowadays ... and in the end - you will like it :-) 3) I wonder if noone of RT's customers asked for printing capabilities? :-) -pekr- Thorsten Moeller wrote:

 [7/22] from: gjones05:mail:orion at: 12-Jun-2001 6:11


From: "Thorsten Moeller" ...
> I was *NOT* able to get the %//prn stuff to work for me as > i don't have an local attached printer. I only have > network-printer at my service, but they didn't care about any > printing command from my W2K box at all. So what can i do?
Good point! I am trying to think of the *common* ways that printers are networked. 1) In Windows environments, I suspect that NetBios is still the most common. The easiest way that I know to print to a Windows networked printer is to reinstall the printer driver and be sure to select the print from ms-dos based programs. Then you will likely need to do "Capture" the printer port. If you have no parallel devices connected to your box, it is easiest to map the ms-dos output to LPT1. Then in REBOL, you can write: write %//lpt1 "Hello, World (or at least, Hello, networked printer)!" Works on my in-home network (ascii or postscript through a venerable HP LaserJet II). 2) I guess that Netware is still very common in places that have been networked for awhile (Wow, how the fortunes of a company can change). I know nothing about Netware, but I do know that it existed in the world when text-based programs abounded, so it must use some sort of port mapping (like lpt1 through IPX/SPX for the original Netware protocol). Any Netware knowledgeable people out there? 3) For true networked printers (meaning directly connected through ethernet with their own IP), I assume that if the printer accepts standard ascii (side bar alert: including the old control sequences that are becoming a distant memory for me --- anyone else remember writing custom print jobs with the control codes??? Things have sure gotten easy...), the IP:port should be directly writeable, or maybe a user:pass needs to be added, depending. If the printer only accepts preformatted code (seemingly most modern printers), then what I would do is what I have done in Windows networked printers. Install a printer driver locally. When printing, direct the output to a file, then write the file to the networked printer. I've done this successfully with HP 722 inkjet in the past. Am I all wet here? I know it is not transparent printer support, but it works for many circumstances, right? Feel free to set me straight on this matter (<humor> but leave my mother and her army boots out of the argument </humor>). --Scott Jones

 [8/22] from: gjones05:mail:orion at: 12-Jun-2001 6:21


From: "Scott Jones"
> Install a printer driver locally. When printing, direct the > output to a file, then write the file to the networked printer. > I've done this successfully with HP 722 inkjet in the > past.
This portion of my argument was disjointed from the rest. Sorry! --Scott Jones

 [9/22] from: sanghabum:aol at: 12-Jun-2001 8:39


Hi Scott,
> 2) I guess that Netware is still very common in places that have been > networked
<<quoted lines omitted: 5>>
> people > out there?
It's been a while since I used Netware, but this used to be the drill: You simply print to LPT1. But first you redirect LPT1 to a Netware print queue with the Capture.exe: capture /q=AccountsLaser Will redirect future print to the printer(s) attached to the spool queue AccountsLaser . Your Netware bods can tell you what queues exist. To get back to the locally attached printers: Endcap (And yes, I do remember writing standard Epson escape codes to make printers do things. I'm glad I don't today). --Colin.

 [10/22] from: allenk:powerup:au at: 12-Jun-2001 23:54


Hi all, If you are able to use a browser and it supports the tag < link rel=alternate media >, then you might be able to use the script on my rebsite. I wrote the script for my own needs, but it might be useful for others. Allows you to choose a html page or text page and pops up the browser print dialog so you can select the print settings. (I suspect this will be a Windows only script though.) On the REBOL Forces reb or do http://www.rebolforces.com/reb/printviabrowser.r Cheers, Allen K

 [11/22] from: holger:rebol at: 12-Jun-2001 9:28


On Tue, Jun 12, 2001 at 10:44:23AM +0200, Petr Krenzelok wrote:
> Hi, > > so, I know how do you feel. I complained the same some time ago here. Nothing > helped, as RT told us there is no easy multiplatform solution to printing. But > message to RT - who cares? ;-):
Sigh... Petr, I wish you would not always take the REBOL feature set so personally. We get a LOT of requests. Some of them make sense, others don't. Some are easy to implement, others are not. Some have cross-platform issues, others don't. Our time is limited and just because your favorite feature does not make it into the next release does not mean we are dismissing the request or ignoring you. Please be patient.
> 1) some multiplatform issues are already broken (e.g. IF someone will use Mac fs > support)
??? Why do you consider Mac filesystem support broken to be broken ? The way get/set-modes and fork support works, it is possible, and easy, to write a REBOL script that, e.g., copies a file, including all Mac forks, and works on all platforms.
> 2) strange sound implementation - it is NOT solved in rebol kernel engine > itself:
<<quoted lines omitted: 5>>
> So, each time you want to open sound port in your script, you have to state > above condition, or your app will fail.
Sure. That's how it works with all features that are not part of Core. Try to use them and catch any error that can occur if the particular version of REBOL or the operating system does not support the feature. Btw, easier: if error? try [ble: open sound://] [ble: none] once in your script. Then whenever you play a sound if ble [error? try [insert ble mysound]] You still need to catch any errors in 'insert though because it is possible for a sound to be incompatible with a sound card or driver, or for the sound hardware driver to be busy.
> I don't understand why it is not solved > the save way as security box dialog - it just asks for persmission.
Because it is not a permission issue. It is an issue of being ABLE to do something or not (which is determined by the system setup), not of being ALLOWED to do something (which is controlled by the user).
> Maybe it > could be solved that way too? If I don't have sound card in my comp, apps using > sound capabilities don't probably require special versions :-)
They don't. App writers need to decide which versions of REBOL they want to support. If you want to run in less functional environments you need to be prepared to handle that. Sound is no different than any other non-Core feature, such as encryption, HTTPS, database support etc.
> I hope that once component system evolves further, these issues will get > resolved ...
It is not an issue of components but of run-time errors. There is no way you can catch ALL possible run-time incompatibilities and errors just by declaration. Some errors cannot be predicted and can only be detected when a feature is used. For instance in Unix you often do not have mixers (or they are not configured or enabled), so you have to deal with the possibility that SOME sounds cannot be played if at the time the sound is played the hardware is used by another program. Windows does not have that problem. -- Holger Kruse [holger--rebol--com]

 [12/22] from: petr:krenzelok:trz:cz at: 12-Jun-2001 21:16


----- Original Message ----- From: "Holger Kruse" <[holger--rebol--com]> To: <[rebol-list--rebol--com]> Sent: Tuesday, June 12, 2001 6:28 PM Subject: [REBOL] Re: How to print a document
> On Tue, Jun 12, 2001 at 10:44:23AM +0200, Petr Krenzelok wrote: > > Hi, > > > > so, I know how do you feel. I complained the same some time ago here.
Nothing
> > helped, as RT told us there is no easy multiplatform solution to
printing. But
> > message to RT - who cares? ;-): > > Sigh...
Although I don't know what "sigh" means, I seem to upset you? :-)
> Petr, I wish you would not always take the REBOL feature set so > personally.
And that's the question. I have probably slight problem in what I say and what do I feel. I feel currently no angry towards anything RT does. And in real (howdy Jeff :-) I already stated that I feel VERY comfort with direction RT took in last two or three months ... Holger - at the end of my message I offered solution - use html output ...
> We get a LOT of requests. Some of them make sense, others don't. > Some are easy to implement, others are not. Some have cross-platform > issues, others don't. Our time is limited and just because your favorite > feature does not make it into the next release does not mean we are
dismissing
> the request or ignoring you. Please be patient.
Ah, that's not about some kind of "my" feature - I remember earlier discussions re printing and I do also remember Carl's word in /Express conference - offered solution was - there will be no direct printing support, use .html. So I tried to offer the view, showing that even in current versions of Rebol, there are some multiplatform issues (e.g. not all features supported by BeOS or Elate as mentioned in docs ...)
> You still need to catch any errors in 'insert though because it is > possible for a sound to be incompatible with a sound card or driver, > or for the sound hardware driver to be busy.
I can understand this one ...
> > I don't understand why it is not solved > > the save way as security box dialog - it just asks for persmission. > > Because it is not a permission issue. It is an issue of being ABLE to > do something or not (which is determined by the system setup), not of > being ALLOWED to do something (which is controlled by the user).
but that's exactly something I wanted to argue upon. Being able to throw ('insert) something into the port is something which belongs to script level.What is more strange is being unable to open sound port only because someone does not use unlocked version. I thought that in such case, we should not push ppl to take care in the script level. That's why I mentioned security dialog - it was meant just as an example. I thought that user would be notified in the beginning that he/she doesn't use unlocked version, but nothing more. Sound system is - or is not available, "sigh" :-) Why should we put special conditions in our source code because of normal vs /Pro version?
> > Maybe it > > could be solved that way too? If I don't have sound card in my comp,
apps using
> > sound capabilities don't probably require special versions :-) > > They don't. App writers need to decide which versions of REBOL they want
to
> support. If you want to run in less functional environments you need to be > prepared to handle that.
See above - we are not talking less functional environments here. Not from OS side of view at least ...
> Sound is no different than any other non-Core feature, > such as encryption, HTTPS, database support etc.
... maybe you are right here, above mentioned features are mostly special features of Command, and will not probably be used in demos, daily user/hobby tasks, etc.
> > I hope that once component system evolves further, these issues will get > > resolved ... > > It is not an issue of components but of run-time errors. There is no way > you can catch ALL possible run-time incompatibilities and errors just by > declaration. Some errors cannot be predicted and can only be detected when > a feature is used. For instance in Unix you often do not have mixers (or
they
> are not configured or enabled), so you have to deal with the possibility
that
> SOME sounds cannot be played if at the time the sound is played the
hardware
> is used by another program. Windows does not have that problem.
Why there is not one and only OS, perfect one, which would solve everything? Time for RT to bring us one :-) -pekr-

 [13/22] from: brian:hawley at: 12-Jun-2001 17:04


Hi all! Thorsten Moeller wrote:
>i ran into the same problem as Francois a while ago. OK, Rebol is a >messaging language per definition, but that should not exclude printing in >all environments. I was *NOT* able to get the %//prn stuff to work for me as >i don't have an local attached printer. I only have network-printer at my >service, but they didn't care about any printing command from my W2K box at >all. So what can i do?
When you setup the network printer mapping on your Win* box, it will ask you if you want to print from MS-DOS programs. Say yes. It will then map the printer to a MS-DOS special port file, like LPT2 or some such, rather than one of the unnamed ports that it will attach to if you say no. Then look in the properties for that printer, on the Ports page, and check which port the printer is attached to. You can write to that port as a file after that. If there is a printer port on your computer then that port will not likely be LPT1 (the one with the PRN alias). Example code: write %lpt2 "Hello World!" Keep in mind that if you want to do more than text output you will have to write in the printer language, usually some HP variant or Postscript. You might find it easier to write Postscript even if your printer doesn't support it - in that case you should use Ghostscript and have it create a virtual printer port to listen to and handle. Tricky, but perhaps easier than generating HP printer codes. Good luck! Brian Hawley P.S.:
>write %//prn "Hello, World!"
The // is not necessary. If your printer is attached to LPT1 (the port with the PRN alias), %prn will do.

 [14/22] from: depotcity:telus at: 12-Jun-2001 16:12


I haven't followed this thread, but I've noticed my print shows a "remained data" message and just sits there forever when I use %//prn "Hello World" on my win2k machine But when I print another document sometime later, say a word doc. then the Rebol message from above prints first, then the doc. It's in a state of suspended animation? T Brownell

 [15/22] from: moeller_thorsten:gmx at: 13-Jun-2001 10:09


Hi Brian, thanks for your detailed description. Things work fine on my win98 machine, but on my W2K-Box the Installation-Assistant works differently. You don't have the choice for MS-Dos association. For local attached Printers i have the same problems as Terry reports in this thread. To have a more flexible approach of printing out things, i think i have to play around with the browser-printing stuff. But thanks again for your assistance. Thorsten -----Ursprungliche Nachricht----- Von: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]Im Auftrag von Brian Hawley Gesendet: Mittwoch, 13. Juni 2001 00:04 An: [rebol-list--rebol--com] Betreff: [REBOL] Re: How to print a document Hi all! Thorsten Moeller wrote:
>i ran into the same problem as Francois a while ago. OK, Rebol is a >messaging language per definition, but that should not exclude printing in >all environments. I was *NOT* able to get the %//prn stuff to work for me
as
>i don't have an local attached printer. I only have network-printer at my >service, but they didn't care about any printing command from my W2K box at >all. So what can i do?
When you setup the network printer mapping on your Win* box, it will ask you if you want to print from MS-DOS programs. Say yes. It will then map the printer to a MS-DOS special port file, like LPT2 or some such, rather than one of the unnamed ports that it will attach to if you say no. Then look in the properties for that printer, on the Ports page, and check which port the printer is attached to. You can write to that port as a file after that. If there is a printer port on your computer then that port will not likely be LPT1 (the one with the PRN alias). Example code: write %lpt2 "Hello World!" Keep in mind that if you want to do more than text output you will have to write in the printer language, usually some HP variant or Postscript. You might find it easier to write Postscript even if your printer doesn't support it - in that case you should use Ghostscript and have it create a virtual printer port to listen to and handle. Tricky, but perhaps easier than generating HP printer codes. Good luck! Brian Hawley P.S.:
>write %//prn "Hello, World!"
The // is not necessary. If your printer is attached to LPT1 (the port with the PRN alias), %prn will do.

 [16/22] from: coussement:c:js:mil:be at: 13-Jun-2001 11:42


Hi Allen: Great approach you use. It can solve some of my problems for now. I did add your script into my *user.r* ;-) thx again, chr==

 [17/22] from: jeff:rebol at: 13-Jun-2001 7:40


Howdy, Petr:
> > Petr, I wish you would not always take the REBOL feature > > set so personally.
<<quoted lines omitted: 3>>
> already stated that I feel VERY comfort with direction RT > took in last two or three months ...
Petr, it's clear to me that you do your best job of expressing your hopes and desires for REBOL in English, which is not your first language. Sometimes we might miss your otherwise optimistic, happy, up-beat feelings towards RT when you are try to express your desires for more capability. Some of this is probably lost in the translation. This stuff takes time to get right, and people may feel how they do about development models, but RT's model has produced a very accelerated pace for REBOL's maturation, creating so much capability in such a short time. Remember the 1.0? Golly, you couldn't even send email with 1.0. If you hit control-D at the command line it crashed. I mean, not bagging on 1.0, just comparing features. Even 2.0 had just a basic set of networking, GC bugs, incomplete error handling, etc. Look at how far REBOL's come now in just two years! View, Command, Express-- piles of capability. It boggles my mind. And take it from me, from the small parts I've contributed and from my lucky vantage point, seeing the efforts of my relentless colleagues, it's been A LOT A LOT A LOT A LOT of work! :-) I would just offer that you might try to find a good Czech translation of the phrase "creeping elegance". The goal has been to make REBOL as capable as anything else out there while staving off "creeping elegance". People who are new to REBOL should not feel overwhelmed by the vastness of REBOL, while REBOL veteran programmers should always be able to find a nice graceful REBOL way of doing advanced programming -- (a never-ending vastness of capability). In real :-) I think REBOL is fitting those constraints of design and utility very well. (-: Salutations! -jeff

 [18/22] from: brian:hawley at: 13-Jun-2001 13:21


Terry Brownell wrote:
>I haven't followed this thread, but I've noticed my print shows a "remained >data" message and just sits there forever when I use %//prn "Hello World" on
<<quoted lines omitted: 3>>
>suspended animation? >T Brownell
Try adding an end-of-file character at the end of your printout. On Windows it should be ^Z. Tell me if that helps... Brian Hawley

 [19/22] from: depotcity:telus at: 13-Jun-2001 14:11


Hi Brian Nope, didn't work. But I think your on the right track. Terry ----- Original Message ----- From: "Brian Hawley" <[brian--hawley--net]> To: <[rebol-list--rebol--com]> Sent: Wednesday, June 13, 2001 11:21 AM Subject: [REBOL] Re: How to print a document
> Terry Brownell wrote: > >I haven't followed this thread, but I've noticed my print shows a
remained
> >data
message and just sits there forever when I use %//prn "Hello World" on

 [20/22] from: phil:harris:zope at: 13-Jun-2001 22:14


Try a ^L (page feed).

 [21/22] from: moeller_thorsten:gmx at: 14-Jun-2001 13:18


Hi Terry, Phil, The ^L does the job on W2K. Thanks Thorsten -----Ursprüngliche Nachricht----- Von: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]Im Auftrag von Phil Harris Gesendet: Mittwoch, 13. Juni 2001 23:15 An: [rebol-list--rebol--com] Betreff: [REBOL] Re: How to print a document Try a ^L (page feed).

 [22/22] from: ssutherl:westmont at: 15-Jun-2001 8:55


There are five ways I can think of that REBOL can prepare for printouts that I can think of: 1. HTML 2. PDF 3. PCL4 (HP command language that all it's printers use). 4. Post Script 5. FAX (maybe? just takes an image file right?) Then there is always saving text directly to the printer device (has to be done by each user.) GS Jones wrote:

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted