all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Printing from WindowXP version of emacs
@ 2005-12-15 15:31 sbrown
  2005-12-15 18:30 ` Mathias Dahl
                   ` (2 more replies)
  0 siblings, 3 replies; 119+ messages in thread
From: sbrown @ 2005-12-15 15:31 UTC (permalink / raw)


I am running GNU emacs v.21.3.1 on my Windows XP system.   Everything
works as it should - except printing.  I am attempting to use a Xerox
Workcenter Pro 238 on a Microsoft Network.  I have spent hours on the
web looking at all the advice on how to get printing to work.  Nothing
seems to help.  Is there a concise statement of how to make this work
somewhere?  Sure am getting tired of copying out of emacs and pasting
into Notepad just to be able to print.

Thanks,
Steve

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-15 15:31 Printing from WindowXP version of emacs sbrown
@ 2005-12-15 18:30 ` Mathias Dahl
  2005-12-15 18:35 ` Lennart Borgman
  2005-12-15 19:36 ` Eli Zaretskii
  2 siblings, 0 replies; 119+ messages in thread
From: Mathias Dahl @ 2005-12-15 18:30 UTC (permalink / raw)


sbrown@raytheon.com writes:

> I am running GNU emacs v.21.3.1 on my Windows XP system.   Everything
> works as it should - except printing.  I am attempting to use a Xerox
> Workcenter Pro 238 on a Microsoft Network.  I have spent hours on the
> web looking at all the advice on how to get printing to work.  Nothing
> seems to help.  Is there a concise statement of how to make this work
> somewhere?  Sure am getting tired of copying out of emacs and pasting
> into Notepad just to be able to print.
>
> Thanks,
> Steve

Let's see if I am faster then Lennart on this one... :)

Check out this page on EmacsWiki:

http://www.emacswiki.org/cgi-bin/wiki/PrintEasyAndWithColorsOnWindows

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-15 15:31 Printing from WindowXP version of emacs sbrown
  2005-12-15 18:30 ` Mathias Dahl
@ 2005-12-15 18:35 ` Lennart Borgman
  2005-12-16  7:50   ` Eli Zaretskii
       [not found]   ` <mailman.19545.1134911104.20277.help-gnu-emacs@gnu.org>
  2005-12-15 19:36 ` Eli Zaretskii
  2 siblings, 2 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-15 18:35 UTC (permalink / raw)
  Cc: help-gnu-emacs

sbrown@raytheon.com wrote:

>I am running GNU emacs v.21.3.1 on my Windows XP system.   Everything
>works as it should - except printing.  I am attempting to use a Xerox
>Workcenter Pro 238 on a Microsoft Network.  I have spent hours on the
>web looking at all the advice on how to get printing to work.  Nothing
>seems to help.  Is there a concise statement of how to make this work
>somewhere?  Sure am getting tired of copying out of emacs and pasting
>into Notepad just to be able to print.
>
>Thanks,
>Steve
>  
>
See http://www.emacswiki.org/cgi-bin/wiki/PrintWithWebBrowser

What should I have put on this page to make it easier to find it?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* RE: Printing from WindowXP version of emacs
@ 2005-12-15 19:36 Jay Bingham
  0 siblings, 0 replies; 119+ messages in thread
From: Jay Bingham @ 2005-12-15 19:36 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1786 bytes --]

<Send replies only to the list not to this address>
In a message dated Thursday, December 15, 2005 9:32 AM sbrown@raytheon.com wrote:
> I am running GNU emacs v.21.3.1 on my Windows XP system.   Everything
> works as it should - except printing.  I am attempting to use a Xerox
> Workcenter Pro 238 on a Microsoft Network.  I have spent hours on the
> web looking at all the advice on how to get printing to work.  Nothing
> seems to help.  Is there a concise statement of how to make this work
> somewhere?  Sure am getting tired of copying out of emacs and pasting
> into Notepad just to be able to print.
Steve,
It might help to know what you have tried, so that those who respond will have
an idea of what is not working for you.  I am not sure what you found on the
Internet or why you were even looking there because all the information that I
needed to get printing working from windows was in the Emacs info nodes.
I have the following in my .emacs.  I have no trouble printing from Emacs
v.21.3 to a networked HP printer (I have printed to other brands of printers as
well) from Windows 2000 PRO (XP should not be any different, I did not need to
change any settings when I upgraded to Win2K from WinNT):
;; set the printer command to null
(setq  lpr-command "")
;; set the default printer name
(setq printer-name "//txnprt01/ps8")
;; set the Postscript printer command to null
(setq  ps-lpr-command "")
;; set the default Postscript printer name
(setq ps-printer-name "//txnprt01/ps8")
;; Turn on duplex printing
(setq ps-spool-duplex t)

-_
J_)
C_)ingham
.    Hewlett-Packard
.    Austin, TX
. "Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire."     -Dr. George W. Crane-


[-- Attachment #1.2: Type: text/html, Size: 2081 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-15 15:31 Printing from WindowXP version of emacs sbrown
  2005-12-15 18:30 ` Mathias Dahl
  2005-12-15 18:35 ` Lennart Borgman
@ 2005-12-15 19:36 ` Eli Zaretskii
  2 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-15 19:36 UTC (permalink / raw)


> From: sbrown@raytheon.com
> Date: 15 Dec 2005 07:31:59 -0800
> 
> I am running GNU emacs v.21.3.1 on my Windows XP system.   Everything
> works as it should - except printing.  I am attempting to use a Xerox
> Workcenter Pro 238 on a Microsoft Network.  I have spent hours on the
> web looking at all the advice on how to get printing to work.  Nothing
> seems to help.  Is there a concise statement of how to make this work
> somewhere?

You can find some advice in the Emacs manual, in the node "MS-DOS
Printing" (it talks about Windows, not only DOS).  Did you try that?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-15 18:35 ` Lennart Borgman
@ 2005-12-16  7:50   ` Eli Zaretskii
  2005-12-16  8:29     ` Lennart Borgman
  2005-12-16  9:19     ` Peter Dyballa
       [not found]   ` <mailman.19545.1134911104.20277.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-16  7:50 UTC (permalink / raw)


> Date: Thu, 15 Dec 2005 19:35:51 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> Cc: help-gnu-emacs@gnu.org
> 
> See http://www.emacswiki.org/cgi-bin/wiki/PrintWithWebBrowser

Yuck!  Don't we have a better way than to submit print jobs to Notepad
and Explorer??

If we need to use external programs at all (and I know of only one
such case: when the printer in question is a network printer that is
not available as a Windows share of the form \\server\share\printer),
then I'd suggest a free program called PrintFile32 (available from
http://www.lerup.com/printfile/).  Configure Emacs to use it as a
replacement for the Unix lpr program.

But I'd like first to hear from the OP which of the advice he's been
given he tried, and what and how didn't work.  In most cases, it is
not necessary to use external programs, as Emacs can do the job
itself.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  7:50   ` Eli Zaretskii
@ 2005-12-16  8:29     ` Lennart Borgman
  2005-12-16  8:53       ` Eli Zaretskii
  2005-12-16  9:26       ` Peter Dyballa
  2005-12-16  9:19     ` Peter Dyballa
  1 sibling, 2 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-16  8:29 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Date: Thu, 15 Dec 2005 19:35:51 +0100
>>From: Lennart Borgman <lennart.borgman.073@student.lu.se>
>>Cc: help-gnu-emacs@gnu.org
>>
>>See http://www.emacswiki.org/cgi-bin/wiki/PrintWithWebBrowser
>>    
>>
>
>Yuck!  Don't we have a better way than to submit print jobs to Notepad
>and Explorer??
>  
>
Did you try it? I have not yet seen a more easy way to print with Emacs 
on MS Windows. Before I wrote this I tested all the alternatives in the 
Emacs MS Windows FAQ. Nothing worked for the networked printers on my job.

With this solution you just load an elisp file and call a function that 
adds printing to the menus. That is it. You do not have to tell where 
the printer is or what type it is.

What you get is printing in colors (if your printer supports it of 
course). It looks exactly as that you have on your screen in Emacs. This 
is what I need. What you perhaps miss is some formatting that can be 
done using the postscript printing solutions in Emacs.

But I may be biased of course ;-)

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  8:29     ` Lennart Borgman
@ 2005-12-16  8:53       ` Eli Zaretskii
  2005-12-16 14:53         ` Lennart Borgman
  2005-12-16  9:26       ` Peter Dyballa
  1 sibling, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-16  8:53 UTC (permalink / raw)


> Date: Fri, 16 Dec 2005 09:29:03 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> Eli Zaretskii wrote:
> 
> >>Date: Thu, 15 Dec 2005 19:35:51 +0100
> >>From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> >>Cc: help-gnu-emacs@gnu.org
> >>
> >>See http://www.emacswiki.org/cgi-bin/wiki/PrintWithWebBrowser
> >>    
> >>
> >
> >Yuck!  Don't we have a better way than to submit print jobs to Notepad
> >and Explorer??
> >  
> Did you try it?

What for?  I've read the code, and I understand what it does.  I don't
doubt for a second that it will work, because I know what ShellExecute
is and does on Windows.

> I have not yet seen a more easy way to print with Emacs on MS
> Windows.

How is it easier than setting up lpr-program and printer-name in your
`.emacs' (which is what I do on all the Windows machines I use)?

> Before I wrote this I tested all the alternatives in the 
> Emacs MS Windows FAQ. Nothing worked for the networked printers on my job.

The NTEmacs FAQ is very old and probably outdated; it is no longer
maintained, AFAIK.  If you wish to retrace the testing you did back
there, I'm sure we could find a solution that is better than passing
the buck to Notepad.

> What you get is printing in colors (if your printer supports it of 
> course). It looks exactly as that you have on your screen in Emacs. This 
> is what I need.

You are free to do what you want, but I have grave reservations about
recommending such solutions to Emacs users at large, while other
solutions exist.  Certainly not as the first alternative.  IMHO, at
the very least.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  7:50   ` Eli Zaretskii
  2005-12-16  8:29     ` Lennart Borgman
@ 2005-12-16  9:19     ` Peter Dyballa
  2005-12-16 10:46       ` Eli Zaretskii
  2005-12-16 14:19       ` Lennart Borgman
  1 sibling, 2 replies; 119+ messages in thread
From: Peter Dyballa @ 2005-12-16  9:19 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 16.12.2005 um 08:50 schrieb Eli Zaretskii:

> the OP

What is that? An acronym, standing for Operational Amplifier? An Other 
Person?

--
Greetings

              ~  O
   Pete       ~~_\\_/%
              ~  O  o

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  8:29     ` Lennart Borgman
  2005-12-16  8:53       ` Eli Zaretskii
@ 2005-12-16  9:26       ` Peter Dyballa
  2005-12-16 10:45         ` Eli Zaretskii
  1 sibling, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2005-12-16  9:26 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 16.12.2005 um 09:29 schrieb Lennart Borgman:

> But I may be biased of course ;-)
>

Maybe, but honestly: there is no better solution for printing on Mac OS 
X and having to print files that are not plain US-ASCII (but ISO 
Latin-9 with €, Greek, Cyrillic, Chinese, Japanese, Korean, UTF-8). The 
detour over HTML and the system's Internet browser produces very good 
output, preserving colours and other attributes (bold, italic faces 
etc).

--
Greetings

   Pete

   Basic, n.:
	A programming language.  Related to certain social diseases in
that those who have it will not admit it in polite company.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  9:26       ` Peter Dyballa
@ 2005-12-16 10:45         ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-16 10:45 UTC (permalink / raw)


> Cc: Eli Zaretskii <eliz@gnu.org>,
>  help-gnu-emacs@gnu.org
> From: Peter Dyballa <Peter_Dyballa@Web.DE>
> Date: Fri, 16 Dec 2005 10:26:43 +0100
> 
> Maybe, but honestly: there is no better solution for printing on Mac OS 
> X and having to print files that are not plain US-ASCII

In that case, may I suggest that you submit an Emacs bug report?
Printing non-ASCII characters should work in Emacs, provided that
either the printer supports those characters directly or it supports
PostScript.  This does work for me, although I never used Emacs on
MacOS.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  9:19     ` Peter Dyballa
@ 2005-12-16 10:46       ` Eli Zaretskii
  2005-12-16 14:19       ` Lennart Borgman
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-16 10:46 UTC (permalink / raw)


OP in the context of mail/news messages means "Original Poster".

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  9:19     ` Peter Dyballa
  2005-12-16 10:46       ` Eli Zaretskii
@ 2005-12-16 14:19       ` Lennart Borgman
  1 sibling, 0 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-16 14:19 UTC (permalink / raw)
  Cc: help-gnu-emacs

Peter Dyballa wrote:

>> the OP
>
>
> What is that? An acronym, standing for Operational Amplifier? An Other 
> Person?

I have never seen an explanation but I have always assumed that it means 
"Original Poster". Some discussions on mailing lists tend to just go 
into new subjects, that why I think OP has been invented.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16  8:53       ` Eli Zaretskii
@ 2005-12-16 14:53         ` Lennart Borgman
  2005-12-16 15:31           ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-16 14:53 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>>>See http://www.emacswiki.org/cgi-bin/wiki/PrintWithWebBrowser
>>>>   
>>>>
>>>>        
>>>>
>>>Yuck!  Don't we have a better way than to submit print jobs to Notepad
>>>and Explorer??
>>> 
>>>      
>>>
>>Did you try it?
>>    
>>
>
>What for?  I've read the code, and I understand what it does.  I don't
>doubt for a second that it will work, because I know what ShellExecute
>is and does on Windows.
>  
>
You have been reading an old version I believe. Please see 
http://ourcomments.org/Emacs/DL/elisp/htmlize-view.el

This does not use Notepad or ShellExecute. It is supposed to be as OS 
independent as possible.

>How is it easier than setting up lpr-program and printer-name in your
>`.emacs' (which is what I do on all the Windows machines I use)?
>  
>
As I have already told this did not work for me.

Let me tell you what I have done and seen. When I started using Emacs I 
looked in the Emacs NT FAQ, searched the Internet and tried everything. 
Nothing worked. Or nearly. I did not try GhostScript/GSView because I 
felt a bit uncomfortable with that. I think the trouble has to do with 
changing network routines in Windows, but I have not investigated it 
further. (Too much job and not very interesting, actually.)

Then I looked into the Emacs C development sources and read a bit about 
the printing interface in Windows. As far as I can see Emacs just does 
not implement the printing interface currently. After lurking around for 
a while I draw the conclusion that it will not do this in the near 
future and certainly not in the next release. It would in my opinion be 
good if it did but I am not sure that everyone agrees on this. (I 
believe GhostScript/GSView might implement a Windows printing interface 
but I do not remember the details right now. It might not have been a 
full implementation.)

However I wanted a simple solution that just worked. That is why I 
suggest the solution above for new users. The browser, whether it is 
Internet Explorer, Firefox or something else implements Windows printing 
interface. They have to, otherwise they would not be able to attract a 
large user base. So I trust that implementation, do not care about it, 
just tells them to show the file created with 
htmlize.el/htmlize-view.el. Then the user just prints as usual from the 
web browser.

The only problem I have seen so far with this is that I sometimes forgot 
that I have left Emacs. The picture in the browser looks exactly as in 
Emacs, htmlize.el is very good (and I can say that without shame, I did 
not write it).

So our different opinions might come out of different experiences. It 
may also have to do with that I feel much at home with the interface 
concept in Windows. Without at all beeing an expert on it I think it is 
an attempt to a good design. All the attempts in Emacs NT FAQ for 
printing bypasses this interface as far as I can see.

>You are free to do what you want, but I have grave reservations about
>recommending such solutions to Emacs users at large, while other
>solutions exist.  Certainly not as the first alternative.  IMHO, at
>the very least.
>
As you probably understand I disagree. I think it creates much less 
trouble for the user if the proposed solution tries to follow the 
interface designed for printing in Windows.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16 14:53         ` Lennart Borgman
@ 2005-12-16 15:31           ` Eli Zaretskii
  2005-12-17  2:42             ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-16 15:31 UTC (permalink / raw)


> Date: Fri, 16 Dec 2005 15:53:28 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> Let me tell you what I have done and seen. When I started using Emacs I 
> looked in the Emacs NT FAQ, searched the Internet and tried everything. 
> Nothing worked. Or nearly. I did not try GhostScript/GSView because I 
> felt a bit uncomfortable with that. I think the trouble has to do with 
> changing network routines in Windows, but I have not investigated it 
> further. (Too much job and not very interesting, actually.)

If you really want to find out what was wrong in your case, you will
have to supply details.  Telling that you ``tried everything and
nothing worked'' will not do.

> Then I looked into the Emacs C development sources and read a bit about 
> the printing interface in Windows. As far as I can see Emacs just does 
> not implement the printing interface currently.

Emacs needs either a port name or a printer name, and it treats those
as if they were files.  These two possibilities cover most of the
Windows printer configurations I've seen.  The question is, what is
your configuration, and why these two possibilities don't work for it.

> >You are free to do what you want, but I have grave reservations about
> >recommending such solutions to Emacs users at large, while other
> >solutions exist.  Certainly not as the first alternative.  IMHO, at
> >the very least.
> >
> As you probably understand I disagree.

I think it was clear that we disagree even without saying that one
more time.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-16 15:31           ` Eli Zaretskii
@ 2005-12-17  2:42             ` Lennart Borgman
  2005-12-17  8:20               ` Eli Zaretskii
       [not found]               ` <mailman.19684.1134911288.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-17  2:42 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Then I looked into the Emacs C development sources and read a bit about 
>>the printing interface in Windows. As far as I can see Emacs just does 
>>not implement the printing interface currently.
>>    
>>
>
>Emacs needs either a port name or a printer name, and it treats those
>as if they were files.  These two possibilities cover most of the
>Windows printer configurations I've seen.  The question is, what is
>your configuration, and why these two possibilities don't work for it.
>  
>
You might be right. Maybe it can work. I do not remember all the tests I 
did any more why they failed and I leave it to someone else who think 
this is worth trying.

However if you want to do it the way you suggest don't you have to know 
the specifics of the printer then? In the environment where I am using a 
printer there are a lot of different printers so I really want to avoid 
doing anything that is printer specific. I want to use the printing 
interface that Windows supply. That interface handles all the printer 
specific details if you call it the right way.

Have I missed something in the sources? Does Emacs use this interface? 
If it does then I am simply wrong. If it does not then I prefer to use 
the system independent interface that Emacs supplies in 
browse-url-of-file which I use in htmlize-view.el.

The implementation of this interface is of course system dependent. What 
I am using is however could be described as the contract called 
browse-url-of-file that has been agreed upon in Emacs. It gives simple 
printing through the browser at least on Windows (and I guess many other 
systems). A big advantage as I see it is that it uses the printing 
interface that Windows has. This makes the handling of printers exactly 
as they use to be in all other Windows programs. I can choose printer, 
orientation, scaling, etc.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17  2:42             ` Lennart Borgman
@ 2005-12-17  8:20               ` Eli Zaretskii
  2005-12-17  9:38                 ` Peter Dyballa
  2005-12-17  9:51                 ` Lennart Borgman
       [not found]               ` <mailman.19684.1134911288.20277.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-17  8:20 UTC (permalink / raw)


> Date: Sat, 17 Dec 2005 03:42:09 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> >Emacs needs either a port name or a printer name, and it treats those
> >as if they were files.  These two possibilities cover most of the
> >Windows printer configurations I've seen.  The question is, what is
> >your configuration, and why these two possibilities don't work for it.
> >
> You might be right. Maybe it can work. I do not remember all the tests I 
> did any more why they failed and I leave it to someone else who think 
> this is worth trying.

It cannot be checked on anyone's machines but yours.  If you don't
think it's worth another try, it will never be investigated.

> However if you want to do it the way you suggest don't you have to know 
> the specifics of the printer then?

You only need to know its name or the port which it captures.  The
Emacs manual explains how to find that out.

> In the environment where I am using a 
> printer there are a lot of different printers so I really want to avoid 
> doing anything that is printer specific. I want to use the printing 
> interface that Windows supply. That interface handles all the printer 
> specific details if you call it the right way.
> 
> Have I missed something in the sources? Does Emacs use this interface? 

AFAIR, you brought this up on the developers' list some time ago.  In
response, you were offered to write code to access the current default
printer on all supported systems, so that Emacs could use that
interface in a platform-independent fashion.  IIRC, that was the last
I've heard about this idea, which IMHO is too bad.

> If it does then I am simply wrong. If it does not then I prefer to use 
> the system independent interface that Emacs supplies in 
> browse-url-of-file which I use in htmlize-view.el.

This interface is for browsing a URL, not for printing.  What we want,
I think, is a way to print on the default printer that doesn't require
the user to press any more buttons or choose menu items on the Web
browser.

Anyway, let's drop this issue.  It's quite clear that you are so happy
with your solution that you don't want to hear anything unfavorable
about it.  Who am I to try preaching to you?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17  8:20               ` Eli Zaretskii
@ 2005-12-17  9:38                 ` Peter Dyballa
  2005-12-17 11:11                   ` Eli Zaretskii
  2005-12-17  9:51                 ` Lennart Borgman
  1 sibling, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2005-12-17  9:38 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 17.12.2005 um 09:20 schrieb Eli Zaretskii:

> This interface is for browsing a URL, not for printing.  What we want,
> I think, is a way to print on the default printer that doesn't require
> the user to press any more buttons or choose menu items on the Web
> browser.
>

It would be nicer, if we'd had the chance to set some parameters for 
printing, like two sides on one page of paper, landscape instead of 
portrait ... All this is introduced with printing from the Internet 
browser. It has this valuable access to the printing interface since 
it's better integrated into the operating system. And Lennart's 
approach delivers too the transformation from the plethora of Emacs 
coding systems to the one: Unicode for printing. The (modern) operating 
system knows how to handle this uniform system in an environment with a 
particuliar language and script.

--
Greetings

   Pete

   It's not the valleys in life I dread so much as the dips.
		-- 	Garfield

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17  8:20               ` Eli Zaretskii
  2005-12-17  9:38                 ` Peter Dyballa
@ 2005-12-17  9:51                 ` Lennart Borgman
  2005-12-17 13:11                   ` Lennart Borgman
  1 sibling, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-17  9:51 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>AFAIR, you brought this up on the developers' list some time ago.  In
>response, you were offered to write code to access the current default
>printer on all supported systems, so that Emacs could use that
>interface in a platform-independent fashion.  IIRC, that was the last
>I've heard about this idea, which IMHO is too bad.
>  
>
Which I have tried to make clear once again would be the wrong solution. 
Unfortunately much more is needed to use the Windows printing interface.

Just as you I am happy to quit this discussion now. I want to say a last 
word to clarify my position on this: If anyone want to write the piece 
of code that is required for using the Windows printing interface from 
within Emacs that would very nice. That would be the right solution in 
my opinion. (As far as I know this will always bring up a box from the 
Windows printing interface asking for some options for printing. But I 
am not sure.)

I do not know how much work this is. What I believe is that it should 
mimic the code in Emacs writing to the screen. There are surely code 
doing this kind of things in projects like Firefox, OpenOffice.org etc.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17  9:38                 ` Peter Dyballa
@ 2005-12-17 11:11                   ` Eli Zaretskii
  2005-12-17 15:50                     ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-17 11:11 UTC (permalink / raw)


> Cc: help-gnu-emacs@gnu.org
> From: Peter Dyballa <Peter_Dyballa@Web.DE>
> Date: Sat, 17 Dec 2005 10:38:45 +0100
> 
> 
> Am 17.12.2005 um 09:20 schrieb Eli Zaretskii:
> 
> > This interface is for browsing a URL, not for printing.  What we want,
> > I think, is a way to print on the default printer that doesn't require
> > the user to press any more buttons or choose menu items on the Web
> > browser.
> 
> It would be nicer, if we'd had the chance to set some parameters for 
> printing, like two sides on one page of paper, landscape instead of 
> portrait

The CVS version of Emacs has the printing.el package that is supposed
to provide these features.  But it only does that for PostScript
output.  It would be a good idea to extend that so that external
programs such as Ghostscript would not be required.  In other words,
we need a platform-independent API to communicate with the system
printers, and then we need to use that API in printing.el.

If someone really cares about better printing facilities in Emacs,
they should, IMHO, get busy adding something like that, instead of
hacking up a workaround thru Explorer.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17  9:51                 ` Lennart Borgman
@ 2005-12-17 13:11                   ` Lennart Borgman
  0 siblings, 0 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-17 13:11 UTC (permalink / raw)
  Cc: help-gnu-emacs

Lennart Borgman wrote:

> If anyone want to write the piece of code that is required for using 
> the Windows printing interface from within Emacs that would very nice. 
> That would be the right solution in my opinion. (As far as I know this 
> will always bring up a box from the Windows printing interface asking 
> for some options for printing. But I am not sure.)

I think I have better give some importants remark more about this:

Such a solution would only suffice for simple printing of what is on 
screen. (Which is what htmlize-view.el can do with the help of a web 
browser.) For more complex printing ps-print.el and printing.el is used. 
They do not produce a buffer in Emacs that looks like the printouts. So 
to make the above solution really useful that have to be worked on too. 
Some of the basic support for this (using different fonts and font 
sizes) are in CVS Emacs today, but I do not know if all that is needed 
is there.

And I have no idea if such a solution would be welcome into Emacs 
either. The goal is that Emacs should be as platform independent as 
possible, but the main target is GNU/Linux. I no nothing about printing 
in GNU/Linux so I do not know if those pieces above have any meaning there.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17 11:11                   ` Eli Zaretskii
@ 2005-12-17 15:50                     ` Lennart Borgman
  2005-12-17 16:31                       ` Peter Dyballa
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-17 15:50 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>The CVS version of Emacs has the printing.el package that is supposed
>to provide these features.  But it only does that for PostScript
>output.  It would be a good idea to extend that so that external
>programs such as Ghostscript would not be required.  In other words,
>we need a platform-independent API to communicate with the system
>printers, and then we need to use that API in printing.el.
>  
>
I suggested this in another message and agrees that this would be good, 
but it might be much work. One of the first thing to decide must be how 
that interface should look to be platform indepentent. To understand the 
requirements on the Windows platform a good start is probably here:

   
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/wingdistart_9ezp.asp 

   
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_0r1j.asp 


On windows you use the graphic drivers interface (GDI) for printing as 
you can read there. You do not use PostScript or even care about what 
formats the printers want. Are there something similar available on 
other platforms?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17 15:50                     ` Lennart Borgman
@ 2005-12-17 16:31                       ` Peter Dyballa
  2005-12-17 21:25                         ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2005-12-17 16:31 UTC (permalink / raw)
  Cc: Emacs help


Am 17.12.2005 um 16:50 schrieb Lennart Borgman:

> Are there something similar available on other platforms?

Of course! We have some more decades experience.

Usually there is no GUI. If there is one, it comes from the windowing 
system, for example X11. This one is very basic, so that desktop 
environments like OpenWindows, CDE, KDE, Gnome, (Classic) Mac OS, or, 
Aqua on Mac OS X bring something better.

Below all this all UNIX dialects have a print spool mechanism that is 
now in its 30s. A printer can be attached to parallel, serial, or USB 
ports or exist somewhere in Internet, or Intranet, attached to the net 
or attached to a print host. When you create the print queue for this 
printer you have to give these details to the operating system. OS 
routines then determine what kind of input arrived, and what kind of 
input the printer accepts. If a difference is found, the printer 
queue's input (output of some programme) is converted according the 
printer's needs. These days this mechanism is based on CUPS, the Common 
UNIX Printing System (http://localhost:631/). To access printers on the 
net it uses a slimmed down HTTP connection (so it's open for 
cryptography or authenticated connections to the splendid printer at 
your dean's desk).

These ideas are so simple, that some couldn't resist to copy ...

--
Greetings

   Pete

$ sumascii BILL GATES
   B   I   L   L   G   A   T   E   S
  66+ 73+ 76+ 76+ 71+ 65+ 84+ 69+ 83 = 663

  and add 3 because he's Bill Gates the third.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17 16:31                       ` Peter Dyballa
@ 2005-12-17 21:25                         ` Lennart Borgman
  2005-12-17 23:55                           ` Peter Dyballa
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-17 21:25 UTC (permalink / raw)
  Cc: Emacs help

Peter Dyballa wrote:

>> Are there something similar available on other platforms?
>
>
> Of course! We have some more decades experience.
>
> Usually there is no GUI. If there is one, it comes from the windowing 
> system, for example X11. This one is very basic, so that desktop 
> environments like OpenWindows, CDE, KDE, Gnome, (Classic) Mac OS, or, 
> Aqua on Mac OS X bring something better.
>
> Below all this all UNIX dialects have a print spool mechanism that is 
> now in its 30s. A printer can be attached to parallel, serial, or USB 
> ports or exist somewhere in Internet, or Intranet, attached to the net 
> or attached to a print host. When you create the print queue for this 
> printer you have to give these details to the operating system. OS 
> routines then determine what kind of input arrived, and what kind of 
> input the printer accepts. If a difference is found, the printer 
> queue's input (output of some programme) is converted according the 
> printer's needs. These days this mechanism is based on CUPS, the 
> Common UNIX Printing System (http://localhost:631/). To access 
> printers on the net it uses a slimmed down HTTP connection (so it's 
> open for cryptography or authenticated connections to the splendid 
> printer at your dean's desk).
>
> These ideas are so simple, that some couldn't resist to copy ...

Thanks! I glanced trhough the pages. It looks to me that the printing 
interface in CUPS is different from that normally used by GUI 
applications in Windows.

AFAIU in Windows the operating system through the GDI (graphic device 
interface) using the printer driver takes care of creating the code to 
be sent to the printer.  This does not seem to be the case in CUPS. Is 
not each application there responsible for creating printing code? Do I 
understand it correctly that this the application creates some kind of 
intermediary code that can then be translated through "filters" which 
the printer drivers provide.

Does not this mean that the printing interface as such must have quite 
different implementations in Windows contra system that uses CUPS?

Please note that I am not an expert on printing at all. I am just trying 
to understand.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17 21:25                         ` Lennart Borgman
@ 2005-12-17 23:55                           ` Peter Dyballa
  2005-12-21 18:15                             ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2005-12-17 23:55 UTC (permalink / raw)
  Cc: Emacs help


Am 17.12.2005 um 22:25 schrieb Lennart Borgman:

> It looks to me that the printing interface in CUPS is different from 
> that normally used by GUI applications in Windows.
>

Please beware, Lennart! CUPS is the mechanism that takes takes items 
from the printer queue(s) and transfers them to the right printer.

The print dialog is separated from this. It's almost nothing (lpr 
-Pprinter_queue_name file), or it's an application from OpenWindows, 
CDE, KDE, Gnome, or Aqua on Mac OS X. Usually UNIX programmes use the 
programmatic interface to put something into the spool area, i.e. the 
printer queue. Usually the programme should not need to take care what 
kind of file type this data is. CUPS will recognise this and use means 
to convert the data into a form compatible to the printer's needs -- or 
it fails and raises a message, or the printer fails and CUPS raises 
that message. CUPS can be compared to GDI. CUPS is almost independent 
from what a printer manufacturer delivers, because it uses ISO 
standards (PostScript, PDF -- text is wrapped into PS code, graphics 
too). It needs a PPD file. It tells all about the printer -- accept how 
much RAM it actually has, or which fonts are in the extension 
cartridge. These values can be asked from the printer in PostScript. Or 
a manufacturer delivers a module for the printer GUI that allows the 
user to access the printer and configure things (have you seen HP Web 
JetAdmin? This one is only SNMP based). Since CUPS delivers standards 
to the printers, the programmes usually spool standard data too. 
Filters are needed sometimes, to convert text to PS, or to wrap a 
graphics format into an envelope that allows the printer to print it. 
Ghostscript and GIMP-Print are used to convert text or graphics into 
ESC/P or such proprietary formats. In Linux you have some projects that 
write code for these, LPRng for example, or Gnome Print. (CUPS is 
something like TCP/IP in Internet. Above this level you have useful 
"applications" like FTP or HTTP, or print dialogs.)

The problem is that M$ is always making things badder then they find 
them somewhere else. And once you've discovered a way to use Losedows 
means, next release changes this. It becomes documented at the n+1st 
release. Approximately ...

Now, honestly, in UNIX (*BSD, Linux, Solaris, ...) there are no proper 
print job GUIs. They are in the windowing systems used. And so they're 
probably different every time ... But since GNU Emacs supports 
different outfits and file systems and codings and scripts it should be 
able to support different access to different print job GUIs.

I am no expert too, I think, I just had often to install and to fix 
many things.

--
Greetings

   Pete

Got Mole problems?
Call Avogadro 6.02 x 10^23

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]               ` <mailman.19684.1134911288.20277.help-gnu-emacs@gnu.org>
@ 2005-12-18 18:22                 ` Ilya Zakharevich
  2005-12-18 19:23                   ` Eli Zaretskii
       [not found]                   ` <mailman.19772.1134933877.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Ilya Zakharevich @ 2005-12-18 18:22 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.19684.1134911288.20277.help-gnu-emacs@gnu.org>:
> > However if you want to do it the way you suggest don't you have to know 
> > the specifics of the printer then?
> 
> You only need to know its name or the port which it captures.

You are joking, right?  You have a buffer which contain one character
only.  Suppose it is 'a'.

Please explain how you can print this buffer if all you know about the
printer is that it accessible through the named pipe "/pipe/printer-input".

Now repeat this assuming that the only character in buffer is U+0292.

Are you assuming that sending character "a" to the printer pipe will
print "a" on paper?  This age is long gone...  I'm not even sure that
typical printers-of-today can work with one-sided-connection at all...

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-18 18:22                 ` Ilya Zakharevich
@ 2005-12-18 19:23                   ` Eli Zaretskii
       [not found]                   ` <mailman.19772.1134933877.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-18 19:23 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Sun, 18 Dec 2005 18:22:06 +0000 (UTC)
> Bcc: ilya@gnu.org
> Originator: ilya@powdermilk.math.berkeley.edu
> 
> [A complimentary Cc of this posting was sent to Eli Zaretskii 

Sigh...

> > You only need to know its name or the port which it captures.
> 
> You are joking, right?  You have a buffer which contain one character
> only.  Suppose it is 'a'.
> 
> Please explain how you can print this buffer if all you know about the
> printer is that it accessible through the named pipe "/pipe/printer-input".

Set printer-name to "/pipe/printer-input" and invoke lpr-buffer.

> Now repeat this assuming that the only character in buffer is U+0292.

This doesn't have anything to do with the issue at hand, but the
answer is the same, assuming you have your encoding stuff set up
correctly wrt the encoding supported by the printer.

> Are you assuming that sending character "a" to the printer pipe will
> print "a" on paper?

On MS-Windows, it does.  This thread was about printing on Windows.

> I'm not even sure that typical printers-of-today can work with
> one-sided-connection at all...

Sorry, I don't understand what you mean by one-sided-connection, and
neither what that has to do with this thread.

> Hope this helps,

It doesn't, but I didn't really expect it to.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]   ` <mailman.19545.1134911104.20277.help-gnu-emacs@gnu.org>
@ 2005-12-19  9:58     ` Mathias Dahl
  2005-12-19 21:25       ` Eli Zaretskii
       [not found]       ` <mailman.19857.1135027571.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Mathias Dahl @ 2005-12-19  9:58 UTC (permalink / raw)


Eli Zaretskii <eliz@gnu.org> writes:

> If we need to use external programs at all (and I know of only one
> such case: when the printer in question is a network printer that is
> not available as a Windows share of the form \\server\share\printer),
> then I'd suggest a free program called PrintFile32 (available from
> http://www.lerup.com/printfile/).  Configure Emacs to use it as a
> replacement for the Unix lpr program.
>
> But I'd like first to hear from the OP which of the advice he's been
> given he tried, and what and how didn't work.  In most cases, it is
> not necessary to use external programs, as Emacs can do the job
> itself.

I just wanted to say that I just tested doing what the documentation
for printer-name says; that is to set it to the name of a shared
printer in our network.

So I set it to "//gbgfs1/gbg2b" and then called M-x lpr-buffer

It worked. 

I did not test with colors (it is no color printer) but that probably
won't work in the same way, will it?

Btw, I first tested without setting printer-name (which on Windows XP
has the default value PRN) and printed, and Emacs froze. Don't know
why though.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2005-12-19 11:18 LENNART BORGMAN
  2005-12-19 21:29 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2005-12-19 11:18 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Mathias Dahl <brakjoller@gmail.com>

> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > If we need to use external programs at all (and I know of only one
> > such case: when the printer in question is a network printer 
> that is
> > not available as a Windows share of the form 
> \\server\share\printer),> then I'd suggest a free program called 
> PrintFile32 (available from
> > http://www.lerup.com/printfile/).  Configure Emacs to use it as a
> > replacement for the Unix lpr program.
> >
> > But I'd like first to hear from the OP which of the advice he's been
> > given he tried, and what and how didn't work.  In most cases, it is
> > not necessary to use external programs, as Emacs can do the job
> > itself.
> 
> I just wanted to say that I just tested doing what the documentation
> for printer-name says; that is to set it to the name of a shared
> printer in our network.
> 
> So I set it to "//gbgfs1/gbg2b" and then called M-x lpr-buffer
> 
> It worked. 
> 
> I did not test with colors (it is no color printer) but that probably
> won't work in the same way, will it?
> 
> Btw, I first tested without setting printer-name (which on Windows XP
> has the default value PRN) and printed, and Emacs froze. Don't know
> why though.

I tested here at some printers to see if I was mistaken earlier. To avoid confusion I am testind just from a command shell. What I have done is this:

I take some printer queues on different printers which I normally use without problems. I look at the header in printer queue w32 window to find the host for the printer queue. Then I do

    c:\> copy file.txt \\host-name\queue-name

To my surprise it worked for the first queue. For the next queue I got

    The network path was not found.
        0 file(s) copied.

To be sure on what I am doing I then went to the host for the queue to find the share name instead of the queue name:


    c:\> copy file.txt \\host-name\share-name

This swallowed the job but I get no output and nothing is shown in the printer queue (where I normally see all waiting jobs). 

I believe this is what I found last time I tested about two years ago too. It seems that in some circumstances it actually could work, but not in all. That can explain why it has been so hard trying to clear this out. 

This is why I am recommending using the web browser for printing with htmlize-view.el on MS Windows. It may seem awkward but it works and the output is actually nice IMHO.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found] <mailman.19804.1134991437.20277.help-gnu-emacs@gnu.org>
@ 2005-12-19 16:28 ` Mathias Dahl
  0 siblings, 0 replies; 119+ messages in thread
From: Mathias Dahl @ 2005-12-19 16:28 UTC (permalink / raw)


LENNART BORGMAN <lennart.borgman.073@student.lu.se> writes:

> I tested here at some printers to see if I was mistaken earlier. To
> avoid confusion I am testind just from a command shell. What I have
> done is this...

Avoid confusion? I think you added to it now... :) I tested in Emacs,
not in the command interpreter. Do you get the same results when
setting printer-name (use customize) and then M-x lpr-buffer?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                   ` <mailman.19772.1134933877.20277.help-gnu-emacs@gnu.org>
@ 2005-12-19 17:53                     ` Ilya Zakharevich
  2005-12-19 21:43                       ` Eli Zaretskii
       [not found]                       ` <mailman.19861.1135028638.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Ilya Zakharevich @ 2005-12-19 17:53 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.19772.1134933877.20277.help-gnu-emacs@gnu.org>:
> > Please explain how you can print this buffer if all you know about the
> > printer is that it accessible through the named pipe "/pipe/printer-input".
> 
> Set printer-name to "/pipe/printer-input" and invoke lpr-buffer.

Will not do anything.  This pipe does not accept arbitrary-ASCII input.

> > Now repeat this assuming that the only character in buffer is U+0292.

> This doesn't have anything to do with the issue at hand, but the
> answer is the same, assuming you have your encoding stuff set up
> correctly wrt the encoding supported by the printer.

There is no "encoding supported by the printer".  You may assume that
the printer supports only its only "command set".

> > Are you assuming that sending character "a" to the printer pipe will
> > print "a" on paper?

> On MS-Windows, it does.

I know very little about Win*, but AFAICS, this thread is about the
fact that it does not.

> > I'm not even sure that typical printers-of-today can work with
> > one-sided-connection at all...

> Sorry, I don't understand what you mean by one-sided-connection, and
> neither what that has to do with this thread.

My understanding is that you indeed understand very little about what
this thread is about.

BTW, "connection" is the communication channel between the printer and
the computer.  There is no reason to assume that one can print using
one-sided communication (computer --> printer) only; at some moment
the printer may send some information back to computer, and expect it
perform some action.

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-19  9:58     ` Mathias Dahl
@ 2005-12-19 21:25       ` Eli Zaretskii
       [not found]       ` <mailman.19857.1135027571.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-19 21:25 UTC (permalink / raw)


> From: Mathias Dahl <brakjoller@gmail.com>
> Date: Mon, 19 Dec 2005 10:58:35 +0100
> 
> So I set it to "//gbgfs1/gbg2b" and then called M-x lpr-buffer
> 
> It worked. 

Thanks for testing.  This is how things are supposed to work, and on
many Windows machines it is that easy to accomplish that,

> I did not test with colors (it is no color printer) but that probably
> won't work in the same way, will it?

Well, obviously you cannot see colors on a printer that doesn't
support color ;-).

If the printer is a Postscript printer, though, ps-print has a feature
whereby you can remap faces to use color-less typefaces instead; for
example, the face for comments could use bold-italic, keywords could
come out underlined, etc.  I attach below the mapping I use for a very
long time.

> Btw, I first tested without setting printer-name (which on Windows XP
> has the default value PRN) and printed, and Emacs froze. Don't know
> why though.

Probably the PRN port is captured by some non-existing device, or
something like that.


(setq ps-bold-faces
      '(font-lock-comment-face
	font-lock-keyword-face
	font-lock-builtin-face
	font-lock-function-name-face
	diff-hunk-header-face
	diff-changed-face
	diff-removed-face
	diff-added-face))
(setq ps-italic-faces
      '(font-lock-comment-face
	font-lock-variable-name-face
	font-lock-string-face
	diff-header-face))
(setq ps-underlined-faces
      '(font-lock-type-face
	font-lock-reference-face
	font-lock-builtin-face
	diff-file-header-face
	diff-function-face))

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-19 11:18 LENNART BORGMAN
@ 2005-12-19 21:29 ` Eli Zaretskii
  2005-12-19 22:11   ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-19 21:29 UTC (permalink / raw)


> Date: Mon, 19 Dec 2005 12:18:48 +0100
> From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
> Cc: help-gnu-emacs@gnu.org
> 
> To be sure on what I am doing I then went to the host for the queue to find the share name instead of the queue name:
> 
> 
>     c:\> copy file.txt \\host-name\share-name
> 
> This swallowed the job but I get no output and nothing is shown in the printer queue (where I normally see all waiting jobs). 

You can use the "net use" command to arrange for some port, like LPT2,
to redirect its output to this printer.  (I think this is explained in
the Emacs manual.)  Then all you need to do to print is to set
printer-name to "LPT2",

> I believe this is what I found last time I tested about two years ago too. It seems that in some circumstances it actually could work, but not in all. That can explain why it has been so hard trying to clear this out. 

The only hard-to-solve cases that I've met are those where a printer
has no \\server\share style name, and no port (PRN, LPT1, etc.) that
is captured and redirected to the printer.  These cases are quite
rare, but when they do happen, the only solution I'm aware of is to
use an external program, some work-alike of lpr.

But in most cases, the advice in the manual ``just works''.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-19 17:53                     ` Ilya Zakharevich
@ 2005-12-19 21:43                       ` Eli Zaretskii
       [not found]                       ` <mailman.19861.1135028638.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-19 21:43 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Mon, 19 Dec 2005 17:53:10 +0000 (UTC)
> Bcc: ilya@gnu.org
> Originator: ilya@powdermilk.math.berkeley.edu
> 
> > > Please explain how you can print this buffer if all you know about the
> > > printer is that it accessible through the named pipe "/pipe/printer-input".
> > 
> > Set printer-name to "/pipe/printer-input" and invoke lpr-buffer.
> 
> Will not do anything.  This pipe does not accept arbitrary-ASCII input.

Are we talking about a pipe that you invented or about a pipe that
represents the MS-Windows way of talking to a remote printer?  If it's
a pipe that you invented, then of course you are free to define
whatever behavior for it that suits your current pleasure in this
argument.  But if it's a Windows-style so called ``printer share
name'', then writing `a' to it _will_ print `a' (give or take some
command to force the printer to eject the page after printing a single
character).

> > > Now repeat this assuming that the only character in buffer is U+0292.
> 
> > This doesn't have anything to do with the issue at hand, but the
> > answer is the same, assuming you have your encoding stuff set up
> > correctly wrt the encoding supported by the printer.
> 
> There is no "encoding supported by the printer".  You may assume that
> the printer supports only its only "command set".

I will assume what happens in reality, not some silly rules of game
that you just invented.  In reality, the printer expects the text sent
to it to come in some encoding.

> > > Are you assuming that sending character "a" to the printer pipe will
> > > print "a" on paper?
> 
> > On MS-Windows, it does.
> 
> I know very little about Win*, but AFAICS, this thread is about the
> fact that it does not.

I think you didn't understand at all what we were talking about.  If
you know how to send text from an Emacs buffer to a printer at all,
then sending `a' _will_ print `a'.

> > > I'm not even sure that typical printers-of-today can work with
> > > one-sided-connection at all...
> 
> > Sorry, I don't understand what you mean by one-sided-connection, and
> > neither what that has to do with this thread.
> 
> My understanding is that you indeed understand very little about what
> this thread is about.

My understanding is that you are bored and decided to have some fun by
talking nonsense about issues you ``know very little about''.

> BTW, "connection" is the communication channel between the printer and
> the computer.  There is no reason to assume that one can print using
> one-sided communication (computer --> printer) only; at some moment
> the printer may send some information back to computer, and expect it
> perform some action.

We are not talking at this level, since normal applications never
communicate to printers directly, but through some device driver or
some other piece of software.  That funny pipe you invented is
normally a symbolic name whose I/O is intercepted by such an interface
software and converted into signals that run on the wire; then the
issue of uni- vs bi-directional communications is relevant.

I'm sure you know all this all too well.

> Hope this helps,

As usual, it didn't.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-19 21:29 ` Eli Zaretskii
@ 2005-12-19 22:11   ` Lennart Borgman
  2005-12-19 23:05     ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-19 22:11 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Date: Mon, 19 Dec 2005 12:18:48 +0100
>>From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
>>Cc: help-gnu-emacs@gnu.org
>>
>>To be sure on what I am doing I then went to the host for the queue to find the share name instead of the queue name:
>>
>>
>>    c:\> copy file.txt \\host-name\share-name
>>
>>This swallowed the job but I get no output and nothing is shown in the printer queue (where I normally see all waiting jobs). 
>>    
>>
>
>You can use the "net use" command to arrange for some port, like LPT2,
>to redirect its output to this printer.  (I think this is explained in
>the Emacs manual.)  Then all you need to do to print is to set
>printer-name to "LPT2",
>  
>
I will try, but is there any technical reason to assume that this works 
differently? I guess I can then do

   copy file.txt lpt2:

or should not this work too?

Also, when accessing the printer on this level, as Iliya said, there 
might be some problems. It was a long time ago I looked into this more 
in details, but what about the reset of the printer for example? Can we 
be sure this is done here? I am sure I have seen problems with this 
before, but I forgotten exactly under which circumstances. (It might not 
be under MS Windows.)

Does someone has a good link to an overview of the printer reset, entry 
points to the printer queue etc on MS Windows?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-19 22:11   ` Lennart Borgman
@ 2005-12-19 23:05     ` Eli Zaretskii
  2005-12-19 23:30       ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-19 23:05 UTC (permalink / raw)


> Date: Mon, 19 Dec 2005 23:11:01 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> >You can use the "net use" command to arrange for some port, like LPT2,
> >to redirect its output to this printer.  (I think this is explained in
> >the Emacs manual.)  Then all you need to do to print is to set
> >printer-name to "LPT2",
> >  
> >
> I will try, but is there any technical reason to assume that this works 
> differently?

I don't know, it's hard to tell without taking a good look at how your
printers are configured on that specific system.

> I guess I can then do
> 
>    copy file.txt lpt2:

Yes (but lose the colon after "lpt2", it's redundant).

> or should not this work too?

It should.

> Also, when accessing the printer on this level, as Iliya said, there 
> might be some problems.

What Ilya said made no sense.  You can try it yourself: send any
printable ASCII character to the printer (on a system where Emacs
_can_ refer to a printer by its //share/printer style name), and see
if that character gets printed.  Then, if your printer supports
Latin-1 characters, say, send some Latin-1 characters and see whether
it makes any difference.

> It was a long time ago I looked into this more in details, but what
> about the reset of the printer for example?

What ``reset of the printer''? what does that have to do with this
thread?  We were talking about printing text; by contrast, Reset is a
command that you send via some kind of managerial interface that has
nothing to do with Emacs or its way to send text to the printer.
Please don't make a mistake of taking Ilya's deliberations seriously.

> Can we be sure this is done here?

Why should it be done?  There's no need to reset the printer before,
after, or during sending text to it.

> Does someone has a good link to an overview of the printer reset, entry 
> points to the printer queue etc on MS Windows?

I'm sure the Windows print spooler operation is a fascinating subject,
but it has nothing to do with what we were discussing, which is how to
send text from Emacs to a printer.  These are two orthogonal issues,
in the sense that when I send text from Emacs, I don't need to know
anything about the spooler's operation.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-19 23:05     ` Eli Zaretskii
@ 2005-12-19 23:30       ` Lennart Borgman
  2005-12-20  4:30         ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-19 23:30 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>I will try, but is there any technical reason to assume that this works 
>>differently?
>>    
>>
>
>I don't know, it's hard to tell without taking a good look at how your
>printers are configured on that specific system.
>  
>
As you know I am using for a general solution. I can personally get 
around this problem in a number of ways.

>
>>I guess I can then do
>>
>>   copy file.txt lpt2
>>
>>or should not this work too?
>>    
>>
>
>It should.
>  
>
Thanks.

>>It was a long time ago I looked into this more in details, but what
>>about the reset of the printer for example?
>>    
>>
>
>What ``reset of the printer''? what does that have to do with this
>thread?  We were talking about printing text; by contrast, Reset is a
>command that you send via some kind of managerial interface that has
>nothing to do with Emacs or its way to send text to the printer.
>Please don't make a mistake of taking Ilya's deliberations seriously.
>  
>
I have seen setups where the networked printer was left in some 
PostScript mode after printing. What I was trying to say was that I do 
not know if you bypass the part of the printer setup that resets it 
(from for example PostScript mode) when you access it the way above. But 
I can surely imagine that the ability to do such setups was a bug that 
is gone now. However I do not know the state of this today. That is what 
I am asking about.

It may seem crazy, but I have seen it happen and have had a lot of 
trouble with it. IMO this type of bad design happens because those 
responsible does not understand or does not know all the possibilities.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                       ` <mailman.19861.1135028638.20277.help-gnu-emacs@gnu.org>
@ 2005-12-20  1:11                         ` Ilya Zakharevich
  2005-12-20  4:54                           ` Eli Zaretskii
       [not found]                           ` <mailman.19893.1135054520.20277.help-gnu-emacs@gnu.org>
  2005-12-20 14:45                         ` Peter Boettcher
  1 sibling, 2 replies; 119+ messages in thread
From: Ilya Zakharevich @ 2005-12-20  1:11 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.19861.1135028638.20277.help-gnu-emacs@gnu.org>:
> > > Set printer-name to "/pipe/printer-input" and invoke lpr-buffer.

> > Will not do anything.  This pipe does not accept arbitrary-ASCII input.

> Are we talking about a pipe that you invented or about a pipe that
> represents the MS-Windows way of talking to a remote printer?  If it's
> a pipe that you invented, then of course you are free to define
> whatever behavior for it that suits your current pleasure in this
> argument.

You are right that I do not know exactly the semantic of the pipe in
question (well, I said this in the preceeding message as well).

> But if it's a Windows-style so called ``printer share
> name'', then writing `a' to it _will_ print `a' (give or take some
> command to force the printer to eject the page after printing a single
> character).

What is "a command" when a pipe is concerned?  Do you mean FormFeed
character, or what?

But I still doubt very much that what you say is actually universally
true.  Here are some questions which force my doubts:

 In what encoding is this 'a' printed?  Are long lines wrapped or
 lost?  What is the page size in lines of input?  Should line be
 terminated by CRLF, CR, or LF?

My understanding of printer pipes was that they are just ways to
communicate with the printer without any "format translation" software
in between; and contemporary printers do not have "DOS compatibility"
mode, when you can dump arbitrary ASCII text to them, and they will
print in Courier.

Maybe Win* stuff is organized differently, but then I would like to
see an exact specification - your claim that 'a' is printed as 'a'
shows that one cannot expect to print any Unicode character (given
that UTF-8 is not the "Win* way").

> I will assume what happens in reality, not some silly rules of game
> that you just invented.  In reality, the printer expects the text sent
> to it to come in some encoding.

Definitely, *IF* it accepts text.

> > I know very little about Win*, but AFAICS, this thread is about the
> > fact that it does not.

> I think you didn't understand at all what we were talking about.  If
> you know how to send text from an Emacs buffer to a printer at all,
> then sending `a' _will_ print `a'.

You again discuss "sending text".  This is hardly correlates with
"printing" as it stands today.

> > BTW, "connection" is the communication channel between the printer and
> > the computer.  There is no reason to assume that one can print using
> > one-sided communication (computer --> printer) only; at some moment
> > the printer may send some information back to computer, and expect it
> > perform some action.
> 
> We are not talking at this level, since normal applications never
> communicate to printers directly, but through some device driver or
> some other piece of software.

On Win* this piece of software is called "the operating system".  You
open GDI context (sp?), and draw to this context.

> That funny pipe you invented is normally a symbolic name whose I/O
> is intercepted by such an interface software and converted into
> signals that run on the wire; then the issue of uni- vs
> bi-directional communications is relevant.

True; but you need a way to configure this interface software.  At
least a way to switch it to Unicode input.

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-19 23:30       ` Lennart Borgman
@ 2005-12-20  4:30         ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-20  4:30 UTC (permalink / raw)


> Date: Tue, 20 Dec 2005 00:30:26 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> Eli Zaretskii wrote:
> 
> >>I will try, but is there any technical reason to assume that this works 
> >>differently?
> >>    
> >>
> >
> >I don't know, it's hard to tell without taking a good look at how your
> >printers are configured on that specific system.
> >  
> >
> As you know I am using for a general solution. I can personally get 
> around this problem in a number of ways.

The general solutions was what you already tried and said it didn't
work.  So what remains is specific to your system or to the printer in
question.  Perhaps therein lies a general problem to which we can in
the future find a general solution, but first we need to find a
solution that solves only your specific problem.  We need to move from
specific to general.

> >What ``reset of the printer''? what does that have to do with this
> >thread?  We were talking about printing text; by contrast, Reset is a
> >command that you send via some kind of managerial interface that has
> >nothing to do with Emacs or its way to send text to the printer.
> >Please don't make a mistake of taking Ilya's deliberations seriously.
> >  
> >
> I have seen setups where the networked printer was left in some 
> PostScript mode after printing. What I was trying to say was that I do 
> not know if you bypass the part of the printer setup that resets it 
> (from for example PostScript mode) when you access it the way above.

It is a job of the software that interfaces with the printer more
intimately to do this, not of applications such as Emacs.  I have a
Postscript printer connected to one of my machines, and I never had to
reset it between a job that printed Postscript (e.g., with ps-print)
and a PCL6 job from another application.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-20  1:11                         ` Ilya Zakharevich
@ 2005-12-20  4:54                           ` Eli Zaretskii
       [not found]                           ` <mailman.19893.1135054520.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-20  4:54 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Tue, 20 Dec 2005 01:11:29 +0000 (UTC)
> Bcc: ilya@gnu.org
> Originator: ilya@powdermilk.math.berkeley.edu
> 
> > But if it's a Windows-style so called ``printer share
> > name'', then writing `a' to it _will_ print `a' (give or take some
> > command to force the printer to eject the page after printing a single
> > character).
> 
> What is "a command" when a pipe is concerned?  Do you mean FormFeed
> character, or what?

It depends on the printer and intimate details of its interface with
the computer.  Sending a formfeed would do in (almost) all cases, but
some printers will even do that automatically after some timeout, and
in other cases the printer driver does that.  Some old printers
required that you do that from the printer's panel.

> But I still doubt very much that what you say is actually universally
> true.  Here are some questions which force my doubts:
> 
>  In what encoding is this 'a' printed?

I don't understand the question: the printer is a display device, so
it produces a glyph, not an encoding.  Are you asking in what form the
character arrives at the printer's input line?

>  Are long lines wrapped or lost? What is the page size in lines of
>  input? Should line be terminated by CRLF, CR, or LF? 

Can't say, it depends on the printer's setup, its driver software, and
any other software that sits in between the application that sent the
text and the wire.

> My understanding of printer pipes was that they are just ways to
> communicate with the printer without any "format translation" software
> in between

Then we were talking about two different things.  The ``named pipes''
which Windows users are advised to use in conjunction with Emacs
printing are not direct ways to talk to the printer via the wire, the
traffic to those ``pipes'' is intercepted by spooling software,
translated any number of times as the printer requires (e.g., if the
printer's interface is PostScript, one of those translations converts
the sent text to a PostScript program), and eventually sent over the
wire by a printer driver.

> and contemporary printers do not have "DOS compatibility"
> mode, when you can dump arbitrary ASCII text to them, and they will
> print in Courier.

That's true.  But I wasn't talking about such a mode.  On a modern
Windows system, when you write text to LPT1, the text is captured by
system software and processed as appropriate (which indeed converts it
into commands, but that's something an application is not aware of).

> Maybe Win* stuff is organized differently

It's not, AFAIK, since `lpr' and the printer drivers after it on Unix
are conceptually similar to what happens on Windows.

> but then I would like to see an exact specification - your claim
> that 'a' is printed as 'a' shows that one cannot expect to print any
> Unicode character (given that UTF-8 is not the "Win* way").

I don't have experience with Unicode printing, so I can only
speculate.  I would think that Unicode printing requires to tell the
printer to select an appropriate font, like with terminals.

> > I will assume what happens in reality, not some silly rules of game
> > that you just invented.  In reality, the printer expects the text sent
> > to it to come in some encoding.
> 
> Definitely, *IF* it accepts text.

Well, when I said ``printer'', I actually meant the ``virtual''
printer that is all the applications knows, not the physical printer
(which indeed doesn't accept plain characters nowadays).  For an
application, the name it uses as a file or a pipe is all it knows
about the printer, and that ``virtual printer'' indeed accepts plain
text.

> > If you know how to send text from an Emacs buffer to a printer at all,
> > then sending `a' _will_ print `a'.
> 
> You again discuss "sending text".  This is hardly correlates with
> "printing" as it stands today.

I hope I explained the confusion above.

> > We are not talking at this level, since normal applications never
> > communicate to printers directly, but through some device driver or
> > some other piece of software.
> 
> On Win* this piece of software is called "the operating system".  You
> open GDI context (sp?), and draw to this context.

That's one way, yes.  But you can also set up a port, such as LPT1, to
be captured and sent to the printer, and then when you write to a file
whose name is "LPT1", the OS will do the GDI thing for you.  I think,
conceptually, this is like piping to `lpr' on Unix.

> > That funny pipe you invented is normally a symbolic name whose I/O
> > is intercepted by such an interface software and converted into
> > signals that run on the wire; then the issue of uni- vs
> > bi-directional communications is relevant.
> 
> True; but you need a way to configure this interface software.  At
> least a way to switch it to Unicode input.

Ideally, the OS would do this itself, when it sees UTF-8, but I don't
know if this is how it works.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]       ` <mailman.19857.1135027571.20277.help-gnu-emacs@gnu.org>
@ 2005-12-20  7:41         ` Mathias Dahl
  2005-12-20 19:58           ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Mathias Dahl @ 2005-12-20  7:41 UTC (permalink / raw)


Eli Zaretskii <eliz@gnu.org> writes:

>> I did not test with colors (it is no color printer) but that probably
>> won't work in the same way, will it?
>
> Well, obviously you cannot see colors on a printer that doesn't
> support color ;-).
>
> If the printer is a Postscript printer, though, ps-print has a feature
> whereby you can remap faces to use color-less typefaces instead; for
> example, the face for comments could use bold-italic, keywords could
> come out underlined, etc.  I attach below the mapping I use for a very
> long time.

So, do I use the same technique? First set `printer-name' and then
execute some ps-command, like maybe `ps-print-buffer-with-faces'?

>> Btw, I first tested without setting printer-name (which on Windows XP
>> has the default value PRN) and printed, and Emacs froze. Don't know
>> why though.
>
> Probably the PRN port is captured by some non-existing device, or
> something like that.

OK.

> (setq ps-bold-faces
>       '(font-lock-comment-face
> 	font-lock-keyword-face
> 	font-lock-builtin-face
> 	font-lock-function-name-face
> 	diff-hunk-header-face
> 	diff-changed-face
> 	diff-removed-face
> 	diff-added-face))
> (setq ps-italic-faces
>       '(font-lock-comment-face
> 	font-lock-variable-name-face
> 	font-lock-string-face
> 	diff-header-face))
> (setq ps-underlined-faces
>       '(font-lock-type-face
> 	font-lock-reference-face
> 	font-lock-builtin-face
> 	diff-file-header-face
> 	diff-function-face))

Thanks! I will try to hunt down a PS-capable printer at my office and
make a test.

Maybe I can even redirect the printer output to a file and then use
Ghostscript to make a PDF. I have macros in MS Word that can do this
so it should be possible. If, that is, the printer can be configured
to always print to file. I'll test.

/Mathias

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2005-12-20 10:58 LENNART BORGMAN
  0 siblings, 0 replies; 119+ messages in thread
From: LENNART BORGMAN @ 2005-12-20 10:58 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> > >You can use the "net use" command to arrange for some port, 
> like LPT2,
> > >to redirect its output to this printer.  (I think this is 
> explained in
> > >the Emacs manual.)  Then all you need to do to print is to set
> > >printer-name to "LPT2",
> > >  
> > >
> > I will try, but is there any technical reason to assume that 
> this works 
> > differently?
> 
> I don't know, it's hard to tell without taking a good look at how your
> printers are configured on that specific system.
> 
> > I guess I can then do
> > 
> >    copy file.txt lpt2:
> 
> Yes (but lose the colon after "lpt2", it's redundant).

I have tried this now. First I tried

   net use LPT2: \\host-name\queue-but-not-share-name

This queue name is not a share name too and I just got

    System error 67 has occured.
    The network name can not be found.

Then I used another queue name which is also a share name:

    net use LPT2: \\host-name\share-and-queue-name 

This completed fine. Then I did

    copy file.txt LTP2

No error, but also no output on the printer. Just as before. I also tried using LPT2:. (I also did a "dir L*" ;-)

Suggestions?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                       ` <mailman.19861.1135028638.20277.help-gnu-emacs@gnu.org>
  2005-12-20  1:11                         ` Ilya Zakharevich
@ 2005-12-20 14:45                         ` Peter Boettcher
  2005-12-20 20:21                           ` Eli Zaretskii
  1 sibling, 1 reply; 119+ messages in thread
From: Peter Boettcher @ 2005-12-20 14:45 UTC (permalink / raw)


Eli Zaretskii <eliz@gnu.org> writes (in a discussion with Ilya):

>> There is no "encoding supported by the printer".  You may assume that
>> the printer supports only its only "command set".
>
> I will assume what happens in reality, not some silly rules of game
> that you just invented.  In reality, the printer expects the text sent
> to it to come in some encoding.
>
>> > > Are you assuming that sending character "a" to the printer pipe will
>> > > print "a" on paper?
>> 
>> > On MS-Windows, it does.
>> 
>> I know very little about Win*, but AFAICS, this thread is about the
>> fact that it does not.

There are many printers out there now which do not support PostScript,
do not support PCL, and do not, in fact, even support plain text.
They are often called "winprinters" because the windows drivers
perform all the processing on the host CPU, and send simple rasterized
data to the printer.  The printer itself will not even print "a" when
told to.

On Linux, these printers are accessed via the normal lpr print spools,
but they have filters set up to rasterize the input PS or raw text
before outputing.

The question on windows is: how does one access the driver which (in
some cases) must rasterize the input, rather than going directly to
the device.  Copying plain text to the network name of the printer
seems not to do the right thing universally, which is why I use the
ugly notepad-hack when I need to do this sort of thing.


-Peter

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found] <mailman.19907.1135077565.20277.help-gnu-emacs@gnu.org>
@ 2005-12-20 17:15 ` Mathias Dahl
  0 siblings, 0 replies; 119+ messages in thread
From: Mathias Dahl @ 2005-12-20 17:15 UTC (permalink / raw)


LENNART BORGMAN <lennart.borgman.073@student.lu.se> writes:

> Then I used another queue name which is also a share name:
>
>     net use LPT2: \\host-name\share-and-queue-name 
>
> This completed fine. Then I did
>
>     copy file.txt LTP2
>
> No error, but also no output on the printer. Just as before. I also tried using LPT2:. (I also did a "dir L*" ;-)

Yes, can you please tell us that you tested from Emacs? I know that
the copy is probably equivalent, but why not test as I did? Or maybe
you did already?

1. customize `printer-name' to //server/printer

2. M-x lpr-buffer

What happens?

Sorry if I have missed you writing this already...

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-20  7:41         ` Mathias Dahl
@ 2005-12-20 19:58           ` Eli Zaretskii
  2005-12-20 20:59             ` Drew Adams
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-20 19:58 UTC (permalink / raw)


> From: Mathias Dahl <brakjoller@gmail.com>
> Date: Tue, 20 Dec 2005 08:41:06 +0100
> 
> > If the printer is a Postscript printer, though, ps-print has a feature
> > whereby you can remap faces to use color-less typefaces instead; for
> > example, the face for comments could use bold-italic, keywords could
> > come out underlined, etc.  I attach below the mapping I use for a very
> > long time.
> 
> So, do I use the same technique? First set `printer-name' and then
> execute some ps-command, like maybe `ps-print-buffer-with-faces'?

There's a separate variable ps-printer-name, which defaults to
printer-name's value.  So if the same printer can serve as both
PostScript and non-PostScript one, you need to set only printer-name
and ps-print will work with that as well.

> Maybe I can even redirect the printer output to a file

ps-print will optionally write the output to a file, see the doc
string.

> and then use Ghostscript to make a PDF.

Do you really need a PDF file?  Because if you only want to print in
color to a non-PostScript printer, and you have Ghostscript installed,
you can do that directly.  Here's an example of such a setup:

    (setq ps-printer-name t)
    (setq ps-lpr-command "d:/Aladdin/gs6.01/bin/gswin32c.exe")
    (setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH"
			    "-sDEVICE=mswinpr2"
			    "-sPAPERSIZE=a4"
			    ))

`mswinpr2' is the name used by Ghostscript to access the default
printer, IIRC, and gswin32c.exe is the console version of Ghostscript.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-20 14:45                         ` Peter Boettcher
@ 2005-12-20 20:21                           ` Eli Zaretskii
  2005-12-20 22:22                             ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-20 20:21 UTC (permalink / raw)


> From: Peter Boettcher <boettcher@ll.mit.edu>
> Date: Tue, 20 Dec 2005 09:45:00 -0500
> 
> There are many printers out there now which do not support PostScript,
> do not support PCL, and do not, in fact, even support plain text.
> They are often called "winprinters" because the windows drivers
> perform all the processing on the host CPU, and send simple rasterized
> data to the printer.

True.

> The printer itself will not even print "a" when told to.

That depends on the exact meaning of ``when told to''.  If by that you
mean (what I meant) that the character `a' is written to a port, such
as LPT1, which is captured by the OS and redirected to the printer
interface, then the printer _will_ print ``when told to''.

> On Linux, these printers are accessed via the normal lpr print spools,
> but they have filters set up to rasterize the input PS or raw text
> before outputing.

Similar things happen on MS-Windows; see this page for a more detailed
description:

  http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp

> The question on windows is: how does one access the driver which (in
> some cases) must rasterize the input, rather than going directly to
> the device.

This is a misunderstanding, and if I somehow caused it by inaccurate
or misleading wording, I'm sorry: you do NOT ``go directly to the
device'' on MS-Windows, at least not on its modern versions.  Direct
access to devices is only possible for privileged code, one that
normally runs in the kernel address space or in a device driver.

When, on Windows, Emacs writes to a port such as PRN or to a share
name such as \\server\printer, as if they were normal files, this
creates a printer job that passes through a series of processors (see
the URL above) and only in the end is sent through the wire to the
physical device.

In other words, these names are not some door to the wire that goes to
the printer, they are special names that the OS watches and whose
traffic is captured and processed extensively before it gets to the
device.  Same as on Unix.

> Copying plain text to the network name of the printer seems not to
> do the right thing universally

But not for the reasons that the plain text somehow gets untranslated
to the printer: that is simply impossible on Windows.  There's some
other factor at work here.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* RE: Printing from WindowXP version of emacs
  2005-12-20 19:58           ` Eli Zaretskii
@ 2005-12-20 20:59             ` Drew Adams
  0 siblings, 0 replies; 119+ messages in thread
From: Drew Adams @ 2005-12-20 20:59 UTC (permalink / raw)


I have not been following this thread closely. If this helps at all, good;
if not, please ignore.

I use native Emacs on Windows XP, and I use printing.el for printing. I use
Cygwin, but I don't use the Emacs built especially for Cygwin.

Below are my printer settings, in case they help someone. I use network
printers (in my case, named 4op1135b and 4op1107a) at work, and a local
printer (via PRN) at home. All of the printers are PostScript printers.

printing.el is a great package, IMO. I generally print using the menus it
provides, but you can alternatively use commands (key bindings). The menus
make everything very clear - it's easy to choose exactly the kind of
printing you want, and to switch printing options, including which printer
to use.

Configuration options are well documented in the source file, printing.el.
The exact syntax to use for configuration is a bit confusing (e.g.
"/D:\\\\printer-server\\4op1135b" for non-PostScript printing vs
"\\\\printer-server\\4op1135b" for PostScript printing), but once you have
configured things, the functionality is great. So, if you're having trouble,
try my settings (with your printer names and addresses, of course) and see
if they don't do the trick for you. HTH.

------------8<---------------------------

(setq pr-path-alist
      '((windows "c:/Program Files" PATH ghostview ghostscript)
        (ghostview "c:/Program Files/Ghostgum/gsview")
        (ghostscript "c:/gs/gs8.11/bin")
        (cygwin windows)))
(setq pr-txt-name 'home)
(setq pr-txt-printer-alist
      '((home "" nil "PRN")             ; Local printer
        (4op1135b nil nil               ; Network printer
         "/D:\\\\printer-server\\4op1135b")
        (4op1107a nil nil               ; Network printer
         "/D:\\\\printer-server\\4op1107a")))
(setq pr-ps-name '4op1135b)
(setq pr-ps-printer-alist
      '((home "" nil "" "PRN" (ps-spool-duplex)) ; Local (not duplex)
        (4op1135b "print" nil "/D:"     ; Network
         "\\\\printer-server\\4op1135b"
         (ps-spool-duplex . t))
        (4op1107a "print" nil "/D:"     ; Network
         "\\\\printer-server\\4op1107a"
         (ps-spool-duplex . t))))
(setq pr-temp-dir
      "c:/Documents and Settings/you/Local Settings/Temp") ; Temp files
;;;(setq pr-delete-temp-file nil)  ; Don't delete temp file
(setq pr-faces-p nil) ; Don't print using Emacs face attributes
;; Don't insert ^D (blank page) at end of PostScript.
(setq ps-end-with-control-d nil)
(when (fboundp 'pr-update-menus) (pr-update-menus t))

(global-set-key "\C-ci"  'pr-interface)
(global-set-key "\C-cbp" 'pr-ps-buffer-print)
(global-set-key "\C-cbx" 'pr-ps-buffer-preview)
(global-set-key "\C-cbb" 'pr-ps-buffer-using-ghostscript)
(global-set-key "\C-cb1f" ; Prompt for file
                (lambda () (interactive) (pr-ps-buffer-ps-print 1 t)))
(global-set-key "\C-cb1p"
                (lambda () (interactive) (pr-ps-buffer-ps-print 1 nil)))
(global-set-key "\C-crp" 'pr-ps-region-print)
(global-set-key "\C-crx" 'pr-ps-region-preview)
(global-set-key "\C-crr" 'pr-ps-region-using-ghostscript)
(global-set-key "\C-cr1f"
                (lambda () (interactive) (pr-ps-buffer-ps-print 1 t)))
(global-set-key "\C-cr1p"
                (lambda () (interactive) (pr-ps-buffer-ps-print 1 nil)))

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-20 20:21                           ` Eli Zaretskii
@ 2005-12-20 22:22                             ` Lennart Borgman
  2005-12-21  4:34                               ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-20 22:22 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>Similar things happen on MS-Windows; see this page for a more detailed
>description:
>
>  http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp
>  
>
Seems like a good starting point. I have been reading a bit under 
"Welcome - Part II Desktop Management - Ch 11 Enabling Printing and 
Faxing". Under this you find for example "Printing Concepts - Printing 
Job Formats". To me the usable formats there seems to be EMF and Text. 
The Raw datatypes seems to be for those processes that knows about the 
printer. When I print from any application in Windows I never care about 
the actual printer, just if it is a color printer. Of course I want it 
to work this way in Emacs too.

The Text format seems to be for black and white printing using only ANSI 
characters. Then it seems to me that we want to use EMF. The problem is 
how to do this then.

One solution I was thinking of before when I decided to make the 
prefather of htmlize-view.el was creating EMF just like printing.el 
produces PostScript today. This seems however to be a lot of work and 
especially troublesome if printing.el changes so I abondoned that idea. 
Including code from GhostScript (if there is some GPL variant of that 
today, I am not sure of that actually) or something similar in Emacs 
seems much better then. Should not that code do just the conversion 
above from PostScript to EMF (in principle)? Or am I misunderstanding 
something in the structure of the Windows printing interface here?

>When, on Windows, Emacs writes to a port such as PRN or to a share
>name such as \\server\printer, as if they were normal files, this
>creates a printer job that passes through a series of processors (see
>the URL above) and only in the end is sent through the wire to the
>physical device.
>  
>
Could you give a more specific description of where to find this? I can 
only find something about using those ports for local printing.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                           ` <mailman.19893.1135054520.20277.help-gnu-emacs@gnu.org>
@ 2005-12-20 22:40                             ` Ilya Zakharevich
  2005-12-21  4:42                               ` Eli Zaretskii
       [not found]                               ` <mailman.20004.1135140203.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Ilya Zakharevich @ 2005-12-20 22:40 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.19893.1135054520.20277.help-gnu-emacs@gnu.org>:
> >  In what encoding is this 'a' printed?
> 
> I don't understand the question: the printer is a display device, so
> it produces a glyph, not an encoding.

Given different encodings, the same sequence of bytes should produce
different sequence of glyphs.

> >  Are long lines wrapped or lost? What is the page size in lines of
> >  input? Should line be terminated by CRLF, CR, or LF? 
> 
> Can't say, it depends on the printer's setup, its driver software, and
> any other software that sits in between the application that sent the
> text and the wire.

I'm puzzled again: if you can't say, how can you claim you know how to
print?

> Then we were talking about two different things.  The ``named pipes''
> which Windows users are advised to use in conjunction with Emacs
> printing are not direct ways to talk to the printer via the wire, the
> traffic to those ``pipes'' is intercepted by spooling software,
> translated any number of times as the printer requires

The key question is: translated from *what format*, and you seem to
avoid this question again and again....

> > and contemporary printers do not have "DOS compatibility"
> > mode, when you can dump arbitrary ASCII text to them, and they will
> > print in Courier.
> 
> That's true.  But I wasn't talking about such a mode.  On a modern
> Windows system, when you write text to LPT1, the text is captured by
> system software and processed as appropriate (which indeed converts it
> into commands, but that's something an application is not aware of).

My expectation is that you are wrong.  I expect that the following is
true on "modern Win* systems" too: you can print an arbitrary stuff
"to a file" (as opposed "to a printer"); then sending this file (with
printer commands, or MetaFile info - I do not know) to LPT1 will
produce not the text representation of bytes in the file, but the
initial (graphical) print job.

> I don't have experience with Unicode printing, so I can only
> speculate.  I would think that Unicode printing requires to tell the
> printer to select an appropriate font, like with terminals.

See above.  One *must* know this before one is able to print.

> > > That funny pipe you invented is normally a symbolic name whose I/O
> > > is intercepted by such an interface software and converted into
> > > signals that run on the wire; then the issue of uni- vs
> > > bi-directional communications is relevant.
> > 
> > True; but you need a way to configure this interface software.  At
> > least a way to switch it to Unicode input.
> 
> Ideally, the OS would do this itself, when it sees UTF-8, but I don't
> know if this is how it works.

There is no way to reliably distinguish UTF-8 from any other byte stream.

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-20 22:22                             ` Lennart Borgman
@ 2005-12-21  4:34                               ` Eli Zaretskii
  2005-12-21  7:49                                 ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-21  4:34 UTC (permalink / raw)
  Cc: help-gnu-emacs

> Date: Tue, 20 Dec 2005 23:22:38 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> >When, on Windows, Emacs writes to a port such as PRN or to a share
> >name such as \\server\printer, as if they were normal files, this
> >creates a printer job that passes through a series of processors (see
> >the URL above) and only in the end is sent through the wire to the
> >physical device.
> >  
> >
> Could you give a more specific description of where to find this? I can 
> only find something about using those ports for local printing.

Go to this URL:

  http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp?url=/resources/documentation/Windows/XP/all/reskit/en-us/prdl_pif_dwfo.asp

and then look in the section Printing Processes.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-20 22:40                             ` Ilya Zakharevich
@ 2005-12-21  4:42                               ` Eli Zaretskii
       [not found]                               ` <mailman.20004.1135140203.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-21  4:42 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Tue, 20 Dec 2005 22:40:55 +0000 (UTC)
> Bcc: ilya@gnu.org
> Originator: ilya@powdermilk.math.berkeley.edu
> 
> > >  In what encoding is this 'a' printed?
> > 
> > I don't understand the question: the printer is a display device, so
> > it produces a glyph, not an encoding.
> 
> Given different encodings, the same sequence of bytes should produce
> different sequence of glyphs.

Yes.  If it's encoding you were asking about, then I don't know how
this works in general for non-ASCII files on Windows.  I guess it's
similar to the way Windows uses the codepage that depends on the
current language environment, but that's a guess.

In any case, I don't think encoding is the issue in this thread, which
is about how to print from Emacs.  People who say it doesn't work for
them cannot print even simple ASCII text, where encoding is not an
issue.

> > >  Are long lines wrapped or lost? What is the page size in lines of
> > >  input? Should line be terminated by CRLF, CR, or LF? 
> > 
> > Can't say, it depends on the printer's setup, its driver software, and
> > any other software that sits in between the application that sent the
> > text and the wire.
> 
> I'm puzzled again: if you can't say, how can you claim you know how to
> print?

Because an application that prints doesn't care about these intimate
details of the printer.  It's the system software that actually
processes the printed material (see the URL I posted here earlier)
that needs to know that.

> > Then we were talking about two different things.  The ``named pipes''
> > which Windows users are advised to use in conjunction with Emacs
> > printing are not direct ways to talk to the printer via the wire, the
> > traffic to those ``pipes'' is intercepted by spooling software,
> > translated any number of times as the printer requires
> 
> The key question is: translated from *what format*, and you seem to
> avoid this question again and again....

Translated initially from plain text in whatever encoding we sent it,
but the intermediate formats is something I don;t really know about,
and neither should any application care.  The system processes
involved in the translation should know that.

> > That's true.  But I wasn't talking about such a mode.  On a modern
> > Windows system, when you write text to LPT1, the text is captured by
> > system software and processed as appropriate (which indeed converts it
> > into commands, but that's something an application is not aware of).
> 
> My expectation is that you are wrong.  I expect that the following is
> true on "modern Win* systems" too: you can print an arbitrary stuff
> "to a file" (as opposed "to a printer"); then sending this file (with
> printer commands, or MetaFile info - I do not know) to LPT1 will
> produce not the text representation of bytes in the file, but the
> initial (graphical) print job.

Well, you are wrong, because you assume that LPT1 goes directly to the
printer, but it's not.

> > I don't have experience with Unicode printing, so I can only
> > speculate.  I would think that Unicode printing requires to tell the
> > printer to select an appropriate font, like with terminals.
> 
> See above.  One *must* know this before one is able to print.

That figures, because I never printed Unicode.  So I'm entitled to not
knowing.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21  4:34                               ` Eli Zaretskii
@ 2005-12-21  7:49                                 ` Lennart Borgman
  2005-12-21 18:39                                   ` Lennart Borgman
  2005-12-21 19:33                                   ` Eli Zaretskii
  0 siblings, 2 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-21  7:49 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Date: Tue, 20 Dec 2005 23:22:38 +0100
>>From: Lennart Borgman <lennart.borgman.073@student.lu.se>
>>CC: help-gnu-emacs@gnu.org
>>
>>    
>>
>>>When, on Windows, Emacs writes to a port such as PRN or to a share
>>>name such as \\server\printer, as if they were normal files, this
>>>creates a printer job that passes through a series of processors (see
>>>the URL above) and only in the end is sent through the wire to the
>>>physical device.
>>> 
>>>
>>>      
>>>
>>Could you give a more specific description of where to find this? I can 
>>only find something about using those ports for local printing.
>>    
>>
>
>Go to this URL:
>
>  http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp?url=/resources/documentation/Windows/XP/all/reskit/en-us/prdl_pif_dwfo.asp
>
>and then look in the section Printing Processes.
>  
>
Thanks, but that was on of the pages I have been reading. It is a good 
overview to start with. I am however looking for something about where 
in that picture something like

    c:\> copy file.txt \\host-name\queue-name

ties in. (Or dito using LPT1 etc.) That page I mentioned in another 
message (Print Job Formats) is at the bottom of the content table to the 
left in the page above. Maybe that says a bit, but that is only guesses. 
I am missing some pieces of information here. Seems like we want more 
technical stuff.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-17 23:55                           ` Peter Dyballa
@ 2005-12-21 18:15                             ` Lennart Borgman
  2005-12-21 21:51                               ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-21 18:15 UTC (permalink / raw)
  Cc: Emacs help

Peter Dyballa wrote:

>
> Am 17.12.2005 um 22:25 schrieb Lennart Borgman:
>
>> It looks to me that the printing interface in CUPS is different from 
>> that normally used by GUI applications in Windows.
>>
>
> Please beware, Lennart! CUPS is the mechanism that takes takes items 
> from the printer queue(s) and transfers them to the right printer.
>
> The print dialog is separated from this. It's almost nothing (lpr 
> -Pprinter_queue_name file), or it's an application from OpenWindows, 
> CDE, KDE, Gnome, or Aqua on Mac OS X. Usually UNIX programmes use the 
> programmatic interface to put something into the spool area, i.e. the 
> printer queue. Usually the programme should not need to take care what 
> kind of file type this data is. CUPS will recognise this and use means 
> to convert the data into a form compatible to the printer's needs -- 
> or it fails and raises a message, or the printer fails and CUPS raises 
> that message. 

Thanks, I am glad to learning more here.  The basic difference I can see 
that affects Emacs is the input format to the printing interfaces.  On 
MS Windows the printing interface wants input in the form of EMF to the 
printer drivers. (You can bypass this, but then you have to know more 
about the printer and that is not desireable for a general solution 
IMO.) On those system that uses CUPS other formats are acceptable. (In 
fact I wonder if CUPS can handle EMF.) The filter handling takes care of 
this.

The current architechture for printing in Emacs looks like it is well 
suited for CUPS but not that well for EMF.

Does the above look correct to you, Peter?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21  7:49                                 ` Lennart Borgman
@ 2005-12-21 18:39                                   ` Lennart Borgman
  2005-12-21 19:33                                   ` Eli Zaretskii
  1 sibling, 0 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-21 18:39 UTC (permalink / raw)
  Cc: help-gnu-emacs

Lennart Borgman wrote:

> Eli Zaretskii wrote:
>
>>
>> Go to this URL:
>>
>>  http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp?url=/resources/documentation/Windows/XP/all/reskit/en-us/prdl_pif_dwfo.asp 
>>
>>
>> and then look in the section Printing Processes.
>>  
>>
> Thanks, but that was on of the pages I have been reading. It is a good 
> overview to start with. I am however looking for something about where 
> in that picture something like
>
>    c:\> copy file.txt \\host-name\queue-name
>
> ties in. (Or dito using LPT1 etc.) That page I mentioned in another 
> message (Print Job Formats) is at the bottom of the content table to 
> the left in the page above. Maybe that says a bit, but that is only 
> guesses. I am missing some pieces of information here. Seems like we 
> want more technical stuff.

I have been looking around a bit more. Here is something about device 
drivers, spooling etc:

   
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/prnSpool_65349c7f-8e59-4d93-b5ff-0b346049b7f2.xml.asp

Maybe someone can find more about using copy like above? I have not been 
able to.

   
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_0r1j.asp

So far the only really new thing to me in this thread has been CUPS, 
which I may have heard of before, but obviously forgotten. My 
conclusions for printing from Emacs on MS Windows are then:

- The printing interfaces on MS Windows and CUPS are different in a way 
that you actually have to write rather separate input printing code for 
them or complicated conversion sw. Emacs has good support for CUPS but 
not for the MS Windows printing interface (that wants EMF format).

- I can find nothing that makes me believe that the "copy" type 
solutions should work in all cases. (But I will do some more tests when 
I get time and I wel lcome more facts about this.)

- One solution to the problem is using an external program like 
GhostScript. I have not tried this, but it may be a very good solution. 
The advantage is that with it printing capabilities in Emacs on MS 
Windows are the same as those on *nix like systems with CUPS. The 
drawback is that is more job for the user since another program has to 
be installed.

- Another solution is the one I proposed (and which made some people 
upset for some reason) is using the web browser + 
htmlize-view.el/htmlize.el to print. The advantage is that you do not 
have to install any more programs, just to elisp files. You get 
printouts in colors of exactly the text that you have on the screen. 
There is very little job to do to get this working. The drawbacks is 
that this is not the way you print in Emacs on other systems (though you 
can use it on those systems too). You also have to know a little bit on 
the elisp level to add the files to your load-path and require 
htmlize-view from your .emacs.

I think the last solutions is easier. Other may differ. I think the best 
one can do is to summarize it like above and let the user choose. 
Nothing is right or wrong here. We are looking for working solutions. 
Please add more advantages and drawbacks if you can see some!

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21  7:49                                 ` Lennart Borgman
  2005-12-21 18:39                                   ` Lennart Borgman
@ 2005-12-21 19:33                                   ` Eli Zaretskii
  2005-12-21 20:11                                     ` Lennart Borgman
  1 sibling, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-21 19:33 UTC (permalink / raw)


> Date: Wed, 21 Dec 2005 08:49:13 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> >Go to this URL:
> >
> >  http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp?url=/resources/documentation/Windows/XP/all/reskit/en-us/prdl_pif_dwfo.asp
> >
> >and then look in the section Printing Processes.
> >  
> >
> Thanks, but that was on of the pages I have been reading. It is a good 
> overview to start with. I am however looking for something about where 
> in that picture something like
> 
>     c:\> copy file.txt \\host-name\queue-name
> 
> ties in. (Or dito using LPT1 etc.)

AFAIU, these queues are watched by the spooler, which sends the text
to a printer processor for the designated printer.  The printer
processor converts the text into a data stream suitable for the
printer hardware (e.g., a stream of PCL commands), and then sends that
data stream back to the spooler.  The spooler then sends the data to
the relevant printer monitor, which actually controls the printer's
hardware port.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 19:33                                   ` Eli Zaretskii
@ 2005-12-21 20:11                                     ` Lennart Borgman
  2005-12-21 22:15                                       ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-21 20:11 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Date: Wed, 21 Dec 2005 08:49:13 +0100
>>From: Lennart Borgman <lennart.borgman.073@student.lu.se>
>>CC: help-gnu-emacs@gnu.org
>>
>>    
>>
>>>Go to this URL:
>>>
>>> http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp?url=/resources/documentation/Windows/XP/all/reskit/en-us/prdl_pif_dwfo.asp
>>>
>>>and then look in the section Printing Processes.
>>> 
>>>
>>>      
>>>
>>Thanks, but that was on of the pages I have been reading. It is a good 
>>overview to start with. I am however looking for something about where 
>>in that picture something like
>>
>>    c:\> copy file.txt \\host-name\queue-name
>>
>>ties in. (Or dito using LPT1 etc.)
>>    
>>
>
>AFAIU, these queues are watched by the spooler, which sends the text
>to a printer processor for the designated printer.  The printer
>processor converts the text into a data stream suitable for the
>printer hardware (e.g., a stream of PCL commands), and then sends that
>data stream back to the spooler.  The spooler then sends the data to
>the relevant printer monitor, which actually controls the printer's
>hardware port.
>
It think I saw something like this for ASCII input only. Actually the 
printer processor first calls GDI which produces EMF that is send to the 
printer driver. So this can print text (only ASCII actually if I 
remember correctly). That should mean that the above "copy" should work.

However I do not remember that I saw anything about exactly when this 
works. Do you have an exact link where you found this? Obviously my test 
fails for some printers (most of those I have tried actually) so there 
must be something more.

Last time I looked into this I stopped about here because I thought it 
was not worth the trouble. As far as I can see it will only handle ASCII 
text when it works. I have seen very little that makes me believe that 
GDI can handle PostScript and convert that to EMF in the above scenario. 
Have you seen something suggesting this? (The only thing I have seen was 
something that could have been that for NT4 (another print job format), 
but I am not sure and it seems to be gone in later MS Windows versions.)

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 18:15                             ` Lennart Borgman
@ 2005-12-21 21:51                               ` Eli Zaretskii
  2005-12-21 22:50                                 ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-21 21:51 UTC (permalink / raw)


> Date: Wed, 21 Dec 2005 19:15:44 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> Cc: Emacs help <help-gnu-emacs@gnu.org>
> 
> The basic difference I can see that affects Emacs is the input
> format to the printing interfaces.  On MS Windows the printing
> interface wants input in the form of EMF to the printer drivers.

That is wrong, I think: EMF is just one of the possibilities.  You can
also send TEXT.

> The current architechture for printing in Emacs looks like it is well 
> suited for CUPS but not that well for EMF.
> 
> Does the above look correct to you, Peter?

It doesn't look correct to me.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 20:11                                     ` Lennart Borgman
@ 2005-12-21 22:15                                       ` Eli Zaretskii
  2005-12-21 22:48                                         ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-21 22:15 UTC (permalink / raw)


> Date: Wed, 21 Dec 2005 21:11:01 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> It think I saw something like this for ASCII input only.

I think it's more general than that.

> Actually the printer processor first calls GDI which produces EMF
> that is send to the printer driver.

I don;t think we should worry about what the printer processor does:
it's part of the OS.  What matters is what it accepts, not what it
does with that.

> So this can print text (only ASCII actually if I remember
> correctly).

You probably mean ANSI (which includes 8-bit non-ASCII characters in
addition to ASCII), but I think it's more general than that.  Why
would the mechanism I described be limited to ANSI text?  Why cannot
it work for Unicode as well?

> That should mean that the above "copy" should work.

I don't see how these two issues are related; perhaps I'm missing
something.  If they are NOT related, then the fact that COPY doesn't
work and the inner workings of the Windows printing mechanism are two
almost unrelated subjects, and we are wasting our time talking about
the latter when we are interested in the former.

> However I do not remember that I saw anything about exactly when this 
> works. Do you have an exact link where you found this?

Here, for example:

> Last time I looked into this I stopped about here because I thought it 
> was not worth the trouble. As far as I can see it will only handle ASCII 
> text when it works. I have seen very little that makes me believe that 
> GDI can handle PostScript and convert that to EMF in the above scenario. 

There's no need to convert PostScript to EMF, since a PostScript
printer will be happy accepting the PostScript program as plain text.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 22:15                                       ` Eli Zaretskii
@ 2005-12-21 22:48                                         ` Lennart Borgman
  2005-12-22  4:38                                           ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-21 22:48 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Actually the printer processor first calls GDI which produces EMF
>>that is send to the printer driver.
>>    
>>
>
>I don;t think we should worry about what the printer processor does:
>it's part of the OS.  What matters is what it accepts, not what it
>does with that.
>  
>
I think we need all information we got to get the pieces together here. 
Unfortunately we have to go into a guessing game since none of us seem 
to be able to find all information we need here.

>  
>
>>So this can print text (only ASCII actually if I remember
>>correctly).
>>    
>>
>
>You probably mean ANSI (which includes 8-bit non-ASCII characters in
>addition to ASCII), but I think it's more general than that.  Why
>would the mechanism I described be limited to ANSI text?  Why cannot
>it work for Unicode as well?
>  
>
No. I mean ASCII. Please look at the description of how the Text type is 
handled. That is the description I gave above where the GDI converts to 
EMF. In this process only ASCII is accepted according to the manuals at MS.

>  
>
>>That should mean that the above "copy" should work.
>>    
>>
>
>I don't see how these two issues are related; perhaps I'm missing
>something.  If they are NOT related, then the fact that COPY doesn't
>work and the inner workings of the Windows printing mechanism are two
>almost unrelated subjects, and we are wasting our time talking about
>the latter when we are interested in the former.
>  
>
I am not sure they are unrelated. It might have to do with what the 
process above accepts, but I am not at all sure. I am just trying to 
keep all doors open at the moment. It make things a bit more complicated 
of course, but we are looking for some facts we have not found yet. We 
may well be in a part of the system that sometimes work, but for reasons 
we do not know yet.

I tend to work this way in cases like this. Please do not assume that I 
am not aware that they may not be related. I am.

>  
>
>>However I do not remember that I saw anything about exactly when this 
>>works. Do you have an exact link where you found this?
>>    
>>
>
>Here, for example:
>  
>
Sorry, I think you did not send that.

>  
>
>>Last time I looked into this I stopped about here because I thought it 
>>was not worth the trouble. As far as I can see it will only handle ASCII 
>>text when it works. I have seen very little that makes me believe that 
>>GDI can handle PostScript and convert that to EMF in the above scenario. 
>>    
>>
>
>There's no need to convert PostScript to EMF, since a PostScript
>printer will be happy accepting the PostScript program as plain text.
>  
>
What do you mean? How can you assume that it is a PostScript printer? I 
have not been talking about any such.

And if it where, how can you assume that it is in a state where it 
accepts PostScript? That depends on the behaviour of the specific 
printer driver. I do not believe we can assume anything about that - 
except that it will behave (reasonably) well if we are using the MS 
Windows printing interface in the way it is recommended in the 
documentation.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 21:51                               ` Eli Zaretskii
@ 2005-12-21 22:50                                 ` Lennart Borgman
  2005-12-21 23:41                                   ` Edward O'Connor
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-21 22:50 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Date: Wed, 21 Dec 2005 19:15:44 +0100
>>From: Lennart Borgman <lennart.borgman.073@student.lu.se>
>>Cc: Emacs help <help-gnu-emacs@gnu.org>
>>
>>The basic difference I can see that affects Emacs is the input
>>format to the printing interfaces.  On MS Windows the printing
>>interface wants input in the form of EMF to the printer drivers.
>>    
>>
>
>That is wrong, I think: EMF is just one of the possibilities.  You can
>also send TEXT.
>  
>
Yes, you are right of course. I left it out because I thought it was 
unimportant in the context of printing from Emacs. TEXT handles only 
plain text and only ASCII characters.

>  
>
>>The current architechture for printing in Emacs looks like it is well 
>>suited for CUPS but not that well for EMF.
>>
>>Does the above look correct to you, Peter?
>>    
>>
>
>It doesn't look correct to me.
>  
>
What do you mean? Can you explain what you believe is wrong?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 22:50                                 ` Lennart Borgman
@ 2005-12-21 23:41                                   ` Edward O'Connor
  2005-12-21 23:51                                     ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Edward O'Connor @ 2005-12-21 23:41 UTC (permalink / raw)


> Yes, you are right of course. I left it out because I thought it was
> unimportant in the context of printing from Emacs. TEXT handles only
> plain text and only ASCII characters.

Come again? I suspect for many many people "only plain text and only
ASCII characters" precisely describes the sorts of documents typically
printed from within Emacs.


Ted

-- 
Edward O'Connor
hober0@gmail.com

Ense petit placidam sub libertate quietem.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 23:41                                   ` Edward O'Connor
@ 2005-12-21 23:51                                     ` Lennart Borgman
  0 siblings, 0 replies; 119+ messages in thread
From: Lennart Borgman @ 2005-12-21 23:51 UTC (permalink / raw)
  Cc: help-gnu-emacs

Edward O'Connor wrote:

>>Yes, you are right of course. I left it out because I thought it was
>>unimportant in the context of printing from Emacs. TEXT handles only
>>plain text and only ASCII characters.
>>    
>>
>
>Come again? I suspect for many many people "only plain text and only
>ASCII characters" precisely describes the sorts of documents typically
>printed from within Emacs.
>  
>
ASCII is only the characters up to 127.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-21 22:48                                         ` Lennart Borgman
@ 2005-12-22  4:38                                           ` Eli Zaretskii
  2005-12-22  8:02                                             ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-22  4:38 UTC (permalink / raw)


> Date: Wed, 21 Dec 2005 23:48:24 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> >I don;t think we should worry about what the printer processor does:
> >it's part of the OS.  What matters is what it accepts, not what it
> >does with that.
> >  
> >
> I think we need all information we got to get the pieces together here. 

Well, good luck, then  Getting _all_ the information will take an
enormous amount of time.

> >You probably mean ANSI (which includes 8-bit non-ASCII characters in
> >addition to ASCII), but I think it's more general than that.  Why
> >would the mechanism I described be limited to ANSI text?  Why cannot
> >it work for Unicode as well?
> >  
> >
> No. I mean ASCII. Please look at the description of how the Text type is 
> handled. That is the description I gave above where the GDI converts to 
> EMF. In this process only ASCII is accepted according to the manuals at MS.

No, it accepts 8-bit text.

> >Here, for example:
> >  
> >
> Sorry, I think you did not send that.

Oops.

  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/provider_b941f8a9-ddb3-47ca-afa2-d06c6de2ce74.xml.asp

> >There's no need to convert PostScript to EMF, since a PostScript
> >printer will be happy accepting the PostScript program as plain text.
> >  
> >
> What do you mean? How can you assume that it is a PostScript printer?

If it's not a PostScript printer, you cannot print PostScript to it.

> And if it where, how can you assume that it is in a state where it 
> accepts PostScript?

The printer enters the PostScript state automatically when it sees the
PostScript preamble.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-22  4:38                                           ` Eli Zaretskii
@ 2005-12-22  8:02                                             ` Lennart Borgman
  2005-12-22 19:37                                               ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-22  8:02 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>Well, good luck, then  Getting _all_ the information will take an
>enormous amount of time.
>  
>
Maybe you did misunderstand me?

>>>      
>>>
>>No. I mean ASCII. Please look at the description of how the Text type is 
>>handled. That is the description I gave above where the GDI converts to 
>>EMF. In this process only ASCII is accepted according to the manuals at MS.
>>    
>>
>
>No, it accepts 8-bit text.
>  
>
Sorry, you are right. I misread that part. It only says "This data type 
is based on the ANSI standard, and if an application that has another 
character set creates text data it does not print. This often presents a 
problem in the extended character range, represented by values above 127.".

It does not say that it does not handle the characters above 127 at all 
- which I believed.

>  
>
>>>Here, for example:
>>> 
>>>
>>>      
>>>
>>Sorry, I think you did not send that.
>>    
>>
>
>Oops.
>
>  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/provider_b941f8a9-ddb3-47ca-afa2-d06c6de2ce74.xml.asp
>  
>
Thanks. This is what I have been reading too. I am however not sure that 
this text means that "copy" for example are handled this way. The text 
describes two steps where the spooler is used. In the first step the 
spooler sends the job to GDI for conversion and get it back from GDI. In 
the second step the spooler sends the data to the printer.

Could it not be that "copy" goes directly to the second step? However 
that partly seems to be unimportant now, when I believe that we agree 
that there probably is no way to convert PostScript during the first 
step. See below.

The "copy" in my case fails for most printers I have tried before. One 
possibility is that "copy" goes directly to the second step. I am still 
looking for information about that.

>  
>
>>>There's no need to convert PostScript to EMF, since a PostScript
>>>printer will be happy accepting the PostScript program as plain text.
>>> 
>>>
>>>      
>>>
>>What do you mean? How can you assume that it is a PostScript printer?
>>    
>>
>
>If it's not a PostScript printer, you cannot print PostScript to it.
>  
>
In the beginning of this long thread you said that it was a bad advice 
to tell new users to print from Emacs through their web browsers using 
htmlize-view.el. This provides colored printing. The printer of course 
must be a color printer, but it does not have to support PostScript.

If you want to print in colors from within Emacs then the only option is 
that it produces PostScript. Now I have assumed that we were looking for 
a way to get this printed even if the printer itself does not understand 
PostScript. One way to do this is using an external program like 
GhostScript. I said I wanted to avoid using an external program (except 
for the web browser which is already there and is already used by Emacs 
through browse-url-of-file for example).

I know of course there is a more basic problem: I can not even get black 
and white printing to work the way you have suggested (but there still 
might be one possibility left which I have not tried yet). However I 
keep both these problems (printing at all and printing PostScript) in 
mind while looking at the documentation. I am sorry if I have not been 
clear on this and you therefore did misunderstand me.

>  
>
>>And if it where, how can you assume that it is in a state where it 
>>accepts PostScript?
>>    
>>
>
>The printer enters the PostScript state automatically when it sees the
>PostScript preamble.
>  
>
I am sorry but I have seen printers where this does not happen.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-22  8:02                                             ` Lennart Borgman
@ 2005-12-22 19:37                                               ` Eli Zaretskii
  2005-12-22 20:46                                                 ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-22 19:37 UTC (permalink / raw)


> Date: Thu, 22 Dec 2005 09:02:28 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> Sorry, you are right. I misread that part. It only says "This data type 
> is based on the ANSI standard, and if an application that has another 
> character set creates text data it does not print. This often presents a 
> problem in the extended character range, represented by values above 127.".
> 
> It does not say that it does not handle the characters above 127 at all 
> - which I believed.

ANSI text means, in Windows parlance, the 8-bit codepages used in
European locales.  Also, in some other place in MSDN they say
explicitly that 8-bit characters are accepted, but I cannot find that
place anymore.

> >  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/provider_b941f8a9-ddb3-47ca-afa2-d06c6de2ce74.xml.asp
> >  
> >
> Thanks. This is what I have been reading too. I am however not sure that 
> this text means that "copy" for example are handled this way. The text 
> describes two steps where the spooler is used. In the first step the 
> spooler sends the job to GDI for conversion and get it back from GDI. In 
> the second step the spooler sends the data to the printer.
> 
> Could it not be that "copy" goes directly to the second step?

No.  The steps described in the above URL all happen _after_ the text
was sent to the spooler.  What the text does not describe is how
writing to PRN or \\server\printer winds up in the spool area.

> If you want to print in colors from within Emacs then the only option is 
> that it produces PostScript.

PostScript printing to a non-PostScript printer will only work thru
Ghostscript.

Anyway, I was talking about a different issue: how to find out why
COPY or the ways suggested for printing normal (non-color) text from
Emacs don't work in your case.  That has nothing to do with PostScript
and colors.

> I know of course there is a more basic problem: I can not even get black 
> and white printing to work the way you have suggested

Right, and that is the problem I thought we were trying to solve in
this thread.

> >The printer enters the PostScript state automatically when it sees the
> >PostScript preamble.
> >  
> I am sorry but I have seen printers where this does not happen.

They are either broken or incorrectly set up.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-22 19:37                                               ` Eli Zaretskii
@ 2005-12-22 20:46                                                 ` Lennart Borgman
  2005-12-23  8:21                                                   ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-22 20:46 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>ANSI text means, in Windows parlance, the 8-bit codepages used in
>European locales.  Also, in some other place in MSDN they say
>explicitly that 8-bit characters are accepted, but I cannot find that
>place anymore.
>  
>
Thanks. Sounds like a reasonable strategi for MS.

>  
>
>>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/provider_b941f8a9-ddb3-47ca-afa2-d06c6de2ce74.xml.asp
>>> 
>>>
>>>      
>>>
>>Thanks. This is what I have been reading too. I am however not sure that 
>>this text means that "copy" for example are handled this way. The text 
>>describes two steps where the spooler is used. In the first step the 
>>spooler sends the job to GDI for conversion and get it back from GDI. In 
>>the second step the spooler sends the data to the printer.
>>
>>Could it not be that "copy" goes directly to the second step?
>>    
>>
>
>No.  The steps described in the above URL all happen _after_ the text
>was sent to the spooler.  What the text does not describe is how
>writing to PRN or \\server\printer winds up in the spool area.
>  
>
I guess you are right, but I am not absolutely sure. Does not the 
spooler also handle RAW data? This kind of data would come in at the 
second step (or was there something more which I have forgotten at the 
moment?).

>PostScript printing to a non-PostScript printer will only work thru
>Ghostscript.
>  
>
Yes, it looks like that.

>Anyway, I was talking about a different issue: how to find out why
>COPY or the ways suggested for printing normal (non-color) text from
>Emacs don't work in your case.  That has nothing to do with PostScript
>and colors.
>  
>
We are talking about two problems. I wanted it to be very clear that 
there are only two options that we are aware of now to get color printing:

    1) Using the externa program Ghostscript
    2) Using the elisp file htmlize-view.el (or something similar)

I think this thread has made this very clear too.


>Right, and that is the problem I thought we were trying to solve in
>this thread.
>  
>
I would like to solve that too if we can. At the moment I am out of 
ideas. Not totally of course (see above), but I do not know what to test 
further.

The printer we are currently talking about works perfectly well 
otherwise. I print to it several times every day.

>  
>
>>>The printer enters the PostScript state automatically when it sees the
>>>PostScript preamble.
>>> 
>>>      
>>>
>>I am sorry but I have seen printers where this does not happen.
>>    
>>
>
>They are either broken or incorrectly set up.
>
I am not sure of that. This happened in a mixed computer environment.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                               ` <mailman.20004.1135140203.20277.help-gnu-emacs@gnu.org>
@ 2005-12-22 23:11                                 ` Ilya Zakharevich
  2005-12-23  8:41                                   ` Eli Zaretskii
       [not found]                                   ` <mailman.20241.1135327583.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Ilya Zakharevich @ 2005-12-22 23:11 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.20004.1135140203.20277.help-gnu-emacs@gnu.org>:
> Yes.  If it's encoding you were asking about, then I don't know how
> this works in general for non-ASCII files on Windows.  I guess it's
> similar to the way Windows uses the codepage that depends on the
> current language environment, but that's a guess.

Easy to check.  Make some file with bytes in the rage 160..255, then
do

  chcp 1252
  copy this-file LPT1
  chcp 1251
  copy this-file LPT1
  chcp 866
  copy this-file LPT1

(May be interesting if FF-between-jobs-is-required...)

> In any case, I don't think encoding is the issue in this thread, which
> is about how to print from Emacs.  People who say it doesn't work for
> them cannot print even simple ASCII text, where encoding is not an
> issue.

Maybe.  But what I was reacting on was your initial claim similar to
"ALL one needs for printing under Win* is to know a name of a pipe".
In my book, "printing ASCII" is hardly equivalent to "printing".

> > > >  Are long lines wrapped or lost? What is the page size in lines of
> > > >  input? Should line be terminated by CRLF, CR, or LF? 

> > > Can't say, it depends on the printer's setup, its driver software, and
> > > any other software that sits in between the application that sent the
> > > text and the wire.

> > I'm puzzled again: if you can't say, how can you claim you know how to
> > print?

> Because an application that prints doesn't care about these intimate
> details of the printer.

???  IIRC, now we are discussing not the printer, but the pipe...
Anyway, consider these questions as concerning a pipe.  (Yet another
question is how to *force* a sequence of bytes to be recognized as
TEXT [as opposed to MetaFile or RAW_PRINTER_COMMANDS].)

> > The key question is: translated from *what format*, and you seem to
> > avoid this question again and again....

> Translated initially from plain text in whatever encoding we sent it,

"Plain text" is not a description of a format.  And I do not know what
is "whatever encoding"; you have either one encoding, or some other;
obviously the pipe can't recognize both.  But these question are
already asked in two chunks above...

> > > That's true.  But I wasn't talking about such a mode.  On a modern
> > > Windows system, when you write text to LPT1, the text is captured by
> > > system software and processed as appropriate (which indeed converts it
> > > into commands, but that's something an application is not aware of).

> > My expectation is that you are wrong.  I expect that the following is
> > true on "modern Win* systems" too: you can print an arbitrary stuff
> > "to a file" (as opposed "to a printer"); then sending this file (with
> > printer commands, or MetaFile info - I do not know) to LPT1 will
> > produce not the text representation of bytes in the file, but the
> > initial (graphical) print job.

> Well, you are wrong, because you assume that LPT1 goes directly to the
> printer, but it's not.

According to the MS links you posted, I'm right; this pipes accepts
RAW_PRINTER_COMMANDS.  How it distinguishes it from "plain text"
(which it supports "too", whatever it means) is not documented...

> > > I don't have experience with Unicode printing, so I can only
> > > speculate.  I would think that Unicode printing requires to tell the
> > > printer to select an appropriate font, like with terminals.
> > 
> > See above.  One *must* know this before one is able to print.
> 
> That figures, because I never printed Unicode.  So I'm entitled to not
> knowing.

This has nothing to do with Unicode.  Only if you print ASCII only you
can forget about encodings; but again, in many situations even ASCII
is ambiguous - if UCS* are entring the question.  [I hope the pipe
does not try to autodetect UCSle...]

Hope htis helps,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-22 20:46                                                 ` Lennart Borgman
@ 2005-12-23  8:21                                                   ` Eli Zaretskii
  2005-12-23 14:06                                                     ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-23  8:21 UTC (permalink / raw)


> Date: Thu, 22 Dec 2005 21:46:54 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> Does not the spooler also handle RAW data?

Yes, I think it does.

> This kind of data would come in at the second step

The text translated to printer commands (i.e. RAW) comes back to the
spooler, so I think the spooler must know how to handle it.

> We are talking about two problems. I wanted it to be very clear that 
> there are only two options that we are aware of now to get color printing:
> 
>     1) Using the externa program Ghostscript
>     2) Using the elisp file htmlize-view.el (or something similar)

      3) Use a PostScript printer.

> I would like to solve that too if we can. At the moment I am out of 
> ideas. Not totally of course (see above), but I do not know what to test 
> further.

Can you try ``connecting'' that printer to LPT1 or a similar port?
Click Start->Settings->Printers and Faxes, then right-click on the
printer's name, select Properties, and click on the Ports tab.  Find a
free printer port and click on its checkbox.  Then see if COPY and/or
Emacs can print to that port as if it were a file (in Emacs, set
printer-name to that port).

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-22 23:11                                 ` Ilya Zakharevich
@ 2005-12-23  8:41                                   ` Eli Zaretskii
       [not found]                                   ` <mailman.20241.1135327583.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-23  8:41 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Thu, 22 Dec 2005 23:11:24 +0000 (UTC)
> Bcc: ilya@gnu.org
> Originator: ilya@powdermilk.math.berkeley.edu
> 
> > Yes.  If it's encoding you were asking about, then I don't know how
> > this works in general for non-ASCII files on Windows.  I guess it's
> > similar to the way Windows uses the codepage that depends on the
> > current language environment, but that's a guess.
> 
> Easy to check.  Make some file with bytes in the rage 160..255, then
> do
> 
>   chcp 1252
>   copy this-file LPT1
>   chcp 1251
>   copy this-file LPT1
>   chcp 866
>   copy this-file LPT1

Yes, easy.

> > In any case, I don't think encoding is the issue in this thread, which
> > is about how to print from Emacs.  People who say it doesn't work for
> > them cannot print even simple ASCII text, where encoding is not an
> > issue.
> 
> Maybe.  But what I was reacting on was your initial claim similar to
> "ALL one needs for printing under Win* is to know a name of a pipe".
> In my book, "printing ASCII" is hardly equivalent to "printing".

I didn't realize I was talking to lawyers, so forgive me if my wording
was not rigorous enough.

> > > > >  Are long lines wrapped or lost? What is the page size in lines of
> > > > >  input? Should line be terminated by CRLF, CR, or LF? 
> 
> > > > Can't say, it depends on the printer's setup, its driver software, and
> > > > any other software that sits in between the application that sent the
> > > > text and the wire.
> 
> > > I'm puzzled again: if you can't say, how can you claim you know how to
> > > print?
> 
> > Because an application that prints doesn't care about these intimate
> > details of the printer.
> 
> ???  IIRC, now we are discussing not the printer, but the pipe...
> Anyway, consider these questions as concerning a pipe.

If you send text to the pipe (using COPY or file I/O, like Emacs
does), you don't need to be bothered by these details (with the
exception of the EOLs, which I think must be CRLF).  They are taken
care of by the machinery that takes over once the text winds up in the
pipe.

> (Yet another question is how to *force* a sequence of bytes to be
> recognized as TEXT [as opposed to MetaFile or
> RAW_PRINTER_COMMANDS].)

I think the COPY method cannot send RAW commands or EMF.  I think to
send RAW and EMF one needs to use suitable functions of the Windows
API, not simple file I/O.

> > > My expectation is that you are wrong.  I expect that the following is
> > > true on "modern Win* systems" too: you can print an arbitrary stuff
> > > "to a file" (as opposed "to a printer"); then sending this file (with
> > > printer commands, or MetaFile info - I do not know) to LPT1 will
> > > produce not the text representation of bytes in the file, but the
> > > initial (graphical) print job.
> 
> > Well, you are wrong, because you assume that LPT1 goes directly to the
> > printer, but it's not.
> 
> According to the MS links you posted, I'm right; this pipes accepts
> RAW_PRINTER_COMMANDS.  How it distinguishes it from "plain text"
> (which it supports "too", whatever it means) is not documented...

I think it distinguishes given the API calls you use to send the
stuff.

> Only if you print ASCII only you can forget about encodings

I think this is also true if you use the encoding native to the
current locale, since the printer most probably supports that by
default.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-23  8:21                                                   ` Eli Zaretskii
@ 2005-12-23 14:06                                                     ` Lennart Borgman
  2005-12-23 15:20                                                       ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2005-12-23 14:06 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>The text translated to printer commands (i.e. RAW) comes back to the
>spooler, so I think the spooler must know how to handle it.
>  
>
After som new tests I believe your assumption is right. Data from "copy" 
etc probably always goes into the first step in the spoolers handling of 
the data. See further below for more.

>  
>
>>We are talking about two problems. I wanted it to be very clear that 
>>there are only two options that we are aware of now to get color printing:
>>
>>    1) Using the externa program Ghostscript
>>    2) Using the elisp file htmlize-view.el (or something similar)
>>    
>>
>
>      3) Use a PostScript printer.
>  
>
I think we agree more and more (or at least are more and more clear). I 
do not know if this is a good advice or not, I seldom buy a printer. In 
many environments it is of course like "choose your parents", but I am 
sure you know that  ;-)

>  
>
>>I would like to solve that too if we can. At the moment I am out of 
>>ideas. Not totally of course (see above), but I do not know what to test 
>>further.
>>    
>>
>
>Can you try ``connecting'' that printer to LPT1 or a similar port?
>Click Start->Settings->Printers and Faxes, then right-click on the
>printer's name, select Properties, and click on the Ports tab.  Find a
>free printer port and click on its checkbox.  Then see if COPY and/or
>Emacs can print to that port as if it were a file (in Emacs, set
>printer-name to that port).
>
Is this different from "net use" in some respect? I have used that in 
the command file below. The command file does two things:

  1) copy file.txt \\host\queue
  2) net use lpt1: \\host\queue
      copy file.txt lpt1:

I have done this for one printer using different queue names. The result 
is that it works for one name, but not for the other. I also used a 
third name, but I am not quite clear if this is a queue name. It appears 
however in the printer queue window header. (I did not have time to 
check this - perhaps I will do that later.) When it worked it worked in 
both case 1 and 2 above.

To make this more understandable I give the command file and the output 
results below.

I could check this more in details than I have. I do not know however if 
there is more to gain from that. Perhaps it is better that other people 
try to test this too. In my case I believe this means that I can print 
from Emacs simple black and white. I takes some time to test which queue 
to use, but the command file below could make that job easier of course. 
I however still suggest avoiding that job, printing through the web 
browser instead.

I also do not know if there is any reason to believe that one queue 
alwasy work on any printer (if there are several queues).

Here is the command file *print-copy-test.cmd*:
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@setlocal
        @if not "" == "%1" goto print
        @echo.
        @echo Usage: prtest \\host\queu
        @echo.
        @goto end
:print
        @echo.
        @echo.
        @echo *Print tests of %1 ...
        @echo ============================
        net use lpt1: /d
        @rem net use lpt1:
        @rem dir %1
        @rem @echo %errorlevel%
        @rem goto end

        @echo.
        @echo.
        @echo **** Print test 1 of %1
        @echo @rem Print test 1 of %1 >  temp1.cmd
        @echo copy temp1.cmd %1       >> temp1.cmd
        @rem @type temp1.cmd
        @call temp1.cmd
       
        @echo.
        @echo.
        @echo **** Print test 2 of %1
        @echo @rem Print test 2 of %1    > temp2.cmd
        @echo net use lpt1: %1           >> temp2.cmd
        @echo if errorlevel 1 goto end   >> temp2.cmd
        @echo copy temp2.cmd lpt1        >> temp2.cmd
        @echo net use lpt1: /d           >> temp2.cmd
        @echo :end                       >> temp2.cmd
        @rem @type temp2.cmd
        @call temp2.cmd

        @echo.
        @echo.
        @rem net use lpt1:

:end
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<





And here are the outputs of my tests using the command file above (I 
removed the output from the first net use /d):

 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
C:\test>print-copy-test.cmd \\host\printer-name


*Print tests of \\host\printer-name ...
============================

**** Print test 1 of \\host\printer-name

C:\test>copy temp1.cmd \\host\printer-name
The network path was not found.
        0 file(s) copied.


**** Print test 2 of \\host\printer-name

C:\test>net use lpt1: \\host\printer-name
System error 67 has occurred.

The network name cannot be found.


C:\test>if errorlevel 1 goto end


C:\test>

****************************************

C:\test>print-copy-test.cmd \\host\printer-nameduplex


*Print tests of \\host\printer-nameduplex ...
============================

**** Print test 1 of \\host\printer-nameduplex

C:\test>copy temp1.cmd \\host\printer-nameduplex
        1 file(s) copied.


**** Print test 2 of \\host\printer-nameduplex

C:\test>net use lpt1: \\host\printer-nameduplex
The command completed successfully.


C:\test>if errorlevel 1 goto end

C:\test>copy temp2.cmd lpt1
        1 file(s) copied.

C:\test>net use lpt1: /d
lpt1 was deleted successfully.



C:\test>

****************************************

C:\test>print-copy-test.cmd \\host\printer-namepcl


*Print tests of \\host\printer-namepcl ...
============================

**** Print test 1 of \\host\printer-namepcl

C:\test>copy temp1.cmd \\host\printer-namepcl
        1 file(s) copied.


**** Print test 2 of \\host\printer-namepcl

C:\test>net use lpt1: \\host\printer-namepcl
The command completed successfully.


C:\test>if errorlevel 1 goto end

C:\test>copy temp2.cmd lpt1
        1 file(s) copied.

C:\test>net use lpt1: /d
lpt1 was deleted successfully.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-23 14:06                                                     ` Lennart Borgman
@ 2005-12-23 15:20                                                       ` Eli Zaretskii
  2005-12-24 13:49                                                         ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-23 15:20 UTC (permalink / raw)


> Date: Fri, 23 Dec 2005 15:06:43 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> >>    1) Using the externa program Ghostscript
> >>    2) Using the elisp file htmlize-view.el (or something similar)
> >>    
> >>
> >
> >      3) Use a PostScript printer.
> >  
> >
> I think we agree more and more (or at least are more and more clear). I 
> do not know if this is a good advice or not, I seldom buy a printer. In 
> many environments it is of course like "choose your parents", but I am 
> sure you know that  ;-)

Many large firms install printers that support PostScript.  So 3) is
not such an absurd advice, sometimes people simply don't know that
they can use PostScript freely.

> >Can you try ``connecting'' that printer to LPT1 or a similar port?
> >Click Start->Settings->Printers and Faxes, then right-click on the
> >printer's name, select Properties, and click on the Ports tab.  Find a
> >free printer port and click on its checkbox.  Then see if COPY and/or
> >Emacs can print to that port as if it were a file (in Emacs, set
> >printer-name to that port).
> >
> Is this different from "net use" in some respect?

I don't know, it might be.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-23 15:20                                                       ` Eli Zaretskii
@ 2005-12-24 13:49                                                         ` Eli Zaretskii
  2005-12-24 14:39                                                           ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-24 13:49 UTC (permalink / raw)


> Date: Fri, 23 Dec 2005 17:20:40 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > >Can you try ``connecting'' that printer to LPT1 or a similar port?
> > >Click Start->Settings->Printers and Faxes, then right-click on the
> > >printer's name, select Properties, and click on the Ports tab.  Find a
> > >free printer port and click on its checkbox.  Then see if COPY and/or
> > >Emacs can print to that port as if it were a file (in Emacs, set
> > >printer-name to that port).
> > >
> > Is this different from "net use" in some respect?
> 
> I don't know, it might be.

Another thing to try is to use the PRINT command:

  print /d:\\printserver\sharename drive:\path\filename.txt

where filename.txt is the text file to print.  Does that work for you?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-24 13:49                                                         ` Eli Zaretskii
@ 2005-12-24 14:39                                                           ` Eli Zaretskii
  2005-12-24 14:58                                                             ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-24 14:39 UTC (permalink / raw)


> Date: Sat, 24 Dec 2005 15:49:17 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Another thing to try is to use the PRINT command:
> 
>   print /d:\\printserver\sharename drive:\path\filename.txt
> 
> where filename.txt is the text file to print.  Does that work for you?

And yet another is via the Windows ShellExecute API, which has an
interface in Emacs:

  (w32-shell-execute "print" "d:\\path\\to\\document.txt")

Alas, this only works for files whose shortcut menu (the one you see
when you right-click the file's name in the Explorer) includes the
"Print" option.  But at least .txt and .html files should have this,
so you could, e.g., write the output of your HTML-izer to a file and
print it with the above.  This command usually sends to the default
printer.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-24 14:39                                                           ` Eli Zaretskii
@ 2005-12-24 14:58                                                             ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-24 14:58 UTC (permalink / raw)


> Date: Sat, 24 Dec 2005 16:39:25 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> And yet another is via the Windows ShellExecute API, which has an
> interface in Emacs:
> 
>   (w32-shell-execute "print" "d:\\path\\to\\document.txt")

Finally, this page might help some more:

   http://members.shaw.ca/bsanders/printfromdos.htm

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                                   ` <mailman.20241.1135327583.20277.help-gnu-emacs@gnu.org>
@ 2005-12-30  0:38                                     ` Ilya Zakharevich
  2005-12-30 11:44                                       ` Eli Zaretskii
       [not found]                                       ` <mailman.20871.1135945105.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Ilya Zakharevich @ 2005-12-30  0:38 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.20241.1135327583.20277.help-gnu-emacs@gnu.org>:
> > > > > >  Are long lines wrapped or lost? What is the page size in lines of
> > > > > >  input? Should line be terminated by CRLF, CR, or LF? 
> > 
> > > > > Can't say, it depends on the printer's setup, its driver software, and
> > > > > any other software that sits in between the application that sent the
> > > > > text and the wire.
> > 
> > > > I'm puzzled again: if you can't say, how can you claim you know how to
> > > > print?
> > 
> > > Because an application that prints doesn't care about these intimate
> > > details of the printer.
> > 
> > ???  IIRC, now we are discussing not the printer, but the pipe...
> > Anyway, consider these questions as concerning a pipe.
> 
> If you send text to the pipe (using COPY or file I/O, like Emacs
> does), you don't need to be bothered by these details (with the
> exception of the EOLs, which I think must be CRLF).  They are taken
> care of by the machinery that takes over once the text winds up in the
> pipe.

Nonsense.  I'm discussing the input format of this pipe, not the input
format of the printer.

> > (Yet another question is how to *force* a sequence of bytes to be
> > recognized as TEXT [as opposed to MetaFile or
> > RAW_PRINTER_COMMANDS].)

> I think the COPY method cannot send RAW commands or EMF.  I think to
> send RAW and EMF one needs to use suitable functions of the Windows
> API, not simple file I/O.

I believe you are mistaken.

> > According to the MS links you posted, I'm right; this pipes accepts
> > RAW_PRINTER_COMMANDS.  How it distinguishes it from "plain text"
> > (which it supports "too", whatever it means) is not documented...
> 
> I think it distinguishes given the API calls you use to send the
> stuff.

What we are discussing is a pipe.  You use whatever API there is to
write to file (do not know the names of Win* entry points).

> > Only if you print ASCII only you can forget about encodings

> I think this is also true if you use the encoding native to the
> current locale, since the printer most probably supports that by
> default.

There is no "current locale".  You probably mean "current codepage";
one needs to know the output the examples I posted (with chcp).

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2005-12-30  0:38                                     ` Ilya Zakharevich
@ 2005-12-30 11:44                                       ` Eli Zaretskii
       [not found]                                       ` <mailman.20871.1135945105.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2005-12-30 11:44 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Fri, 30 Dec 2005 00:38:07 +0000 (UTC)
> Bcc: ilya@gnu.org
> Originator: ilya@powdermilk.math.berkeley.edu
> 
> > > > Because an application that prints doesn't care about these intimate
> > > > details of the printer.
> > > 
> > > ???  IIRC, now we are discussing not the printer, but the pipe...
> > > Anyway, consider these questions as concerning a pipe.
> > 
> > If you send text to the pipe (using COPY or file I/O, like Emacs
> > does), you don't need to be bothered by these details (with the
> > exception of the EOLs, which I think must be CRLF).  They are taken
> > care of by the machinery that takes over once the text winds up in the
> > pipe.
> 
> Nonsense.  I'm discussing the input format of this pipe, not the input
> format of the printer.

Please re-read my answer: it _was_ about the input format of the
pipe.  I said that you need not bother about the details you were
asking about.
> > > Only if you print ASCII only you can forget about encodings
> 
> > I think this is also true if you use the encoding native to the
> > current locale, since the printer most probably supports that by
> > default.
> 
> There is no "current locale".  You probably mean "current codepage";

If you insist that there's no "current locale" on Windows, please
spell out the difference between it and the "current codepage", on
Windows.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-03  0:49 BRUCE INGALLS
  2006-01-03  5:10 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-03  0:49 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1601 bytes --]

I had been looking for a way to script the MS Windows Printing Common Dialog
Box, to make it available for Emacs.
It looks that it requires some C(++) code, which I had been avoiding, to
make a no-arch package.
Perhaps I shall write a command-line, or otherwise Emacs usable wrapper, one
day.

Windows version 2000 and higher, are bundled with VBScript & JScript, by
default.
I had posted code to gnu.emacs.sources, in Sept. 2005, a way to retrieve the
default printer port into Emacs:

http://groups.google.com/group/gnu.emacs.sources/browse_thread/thread/a9f1a308223bc3b9/e2cf485072e3164b#e2cf485072e3164b

You can easily query all manner of Windows printer properties,
and customize the code above, to bring such into Emacs.

Htmlview & notepad make fine stop-gap measures, to make w32 emacs printing
easier.
However, I don't believe there has been a good explanation, as to why some
zealously believe
that printing must be embedded in, or dedicated to, Emacs.

Essentially, this violates the principle of coupling (and cohesion).
Say, you use Emacs to print ESS spreadsheets, or 132 column code dumps.
This makes sense to do in landscape mode.

However, you might be surprised, when your browser stops printing web pages
in portrait mode.
Next, imagine the impact of intermediate print filter programs, such as
a2ps.

That said, yet another hack is available: there already is code to export
emacs buffers to PDF.
I don't know, if a command-line pdf printing program exists.
I suspect that this will be a slow solution, that leaves garbage files
strewn about.

[-- Attachment #1.2: Type: text/html, Size: 1845 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-03  0:49 BRUCE INGALLS
@ 2006-01-03  5:10 ` Eli Zaretskii
  2006-01-03  9:44 ` Peter Dyballa
       [not found] ` <mailman.21202.1136265134.20277.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-03  5:10 UTC (permalink / raw)


> Date: Mon, 2 Jan 2006 19:49:40 -0500
> From: BRUCE INGALLS <bruce.ingalls@gmail.com>
> 
> Windows version 2000 and higher, are bundled with VBScript & JScript, by
> default.
> I had posted code to gnu.emacs.sources, in Sept. 2005, a way to retrieve the
> default printer port into Emacs:
> 
> http://groups.google.com/group/gnu.emacs.sources/browse_thread/thread/a9f1a308223bc3b9/e2cf485072e3164b#e2cf485072e3164b
> 
> You can easily query all manner of Windows printer properties,
> and customize the code above, to bring such into Emacs.

Thanks.  The question is, will this script find usable ports on
systems where people report they cannot find a port name that Emacs
can use?

> Htmlview & notepad make fine stop-gap measures, to make w32 emacs printing
> easier.
> However, I don't believe there has been a good explanation, as to why some
> zealously believe that printing must be embedded in, or dedicated to, Emacs.

What would be the alternative on Windows, given that an lpr-like
program is not always available?

> That said, yet another hack is available: there already is code to export
> emacs buffers to PDF.

Can we have the URL, please?

> I don't know, if a command-line pdf printing program exists.

If it did (or does) exist, it could be also used to print plain text.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-03  0:49 BRUCE INGALLS
  2006-01-03  5:10 ` Eli Zaretskii
@ 2006-01-03  9:44 ` Peter Dyballa
       [not found] ` <mailman.21202.1136265134.20277.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 119+ messages in thread
From: Peter Dyballa @ 2006-01-03  9:44 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 03.01.2006 um 01:49 schrieb BRUCE INGALLS:

> That said, yet another hack is available: there already is code to  
> export emacs buffers to PDF.


Could you drop some names, please?

--
Greetings

   Pete

A child of five could understand this!  Fetch me a child of five.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found] ` <mailman.21202.1136265134.20277.help-gnu-emacs@gnu.org>
@ 2006-01-03 13:06   ` Chris McMahan
  2006-01-03 19:18     ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Chris McMahan @ 2006-01-03 13:06 UTC (permalink / raw)


Another alternative I just found recently is to use the program
gsprint, which is included in the ghostview program you can find here:
http://www.cs.wisc.edu/~ghost/

I have these settings, which pop up a standard windows print dialog
from which I can select the printer and print.

;;;===================================================
;; use the ghostscript printer program to open a standard printer
;; dialog, works like a charm!!
(setq-default ps-lpr-command (concat UTILS_DIR "/gs/gsview/gsprint.exe"))
(setq-default ps-printer-name t)
(setq-default ps-printer-name-option nil)
(setq ps-lpr-switches '("-query")) ; show printer dialog

- Chris


Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Mon, 2 Jan 2006 19:49:40 -0500
>> From: BRUCE INGALLS <bruce.ingalls@gmail.com>
>> 
>> Windows version 2000 and higher, are bundled with VBScript & JScript, by
>> default.
>> I had posted code to gnu.emacs.sources, in Sept. 2005, a way to retrieve the
>> default printer port into Emacs:
>> 
>> http://groups.google.com/group/gnu.emacs.sources/browse_thread/thread/a9f1a308223bc3b9/e2cf485072e3164b#e2cf485072e3164b
>> 
>> You can easily query all manner of Windows printer properties,
>> and customize the code above, to bring such into Emacs.
>
> Thanks.  The question is, will this script find usable ports on
> systems where people report they cannot find a port name that Emacs
> can use?
>
>> Htmlview & notepad make fine stop-gap measures, to make w32 emacs printing
>> easier.
>> However, I don't believe there has been a good explanation, as to why some
>> zealously believe that printing must be embedded in, or dedicated to, Emacs.
>
> What would be the alternative on Windows, given that an lpr-like
> program is not always available?
>
>> That said, yet another hack is available: there already is code to export
>> emacs buffers to PDF.
>
> Can we have the URL, please?
>
>> I don't know, if a command-line pdf printing program exists.
>
> If it did (or does) exist, it could be also used to print plain text.
>
>

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-03 13:08 LENNART BORGMAN
  2006-01-03 19:20 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-03 13:08 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> > From: BRUCE INGALLS <bruce.ingalls@gmail.com>
> > 
> > Windows version 2000 and higher, are bundled with VBScript & 
> JScript, by
> > default.
> > I had posted code to gnu.emacs.sources, in Sept. 2005, a way to 
> retrieve the
> > default printer port into Emacs:
> > 
> > 
> http://groups.google.com/group/gnu.emacs.sources/browse_thread/thread/a9f1a308223bc3b9/e2cf485072e3164b#e2cf485072e3164b> 
> > You can easily query all manner of Windows printer properties,
> > and customize the code above, to bring such into Emacs.
> 
> Thanks.  The question is, will this script find usable ports on
> systems where people report they cannot find a port name that Emacs
> can use?

If I run w32prn-customize I get an error. w32prn-default returns something like

  PDF-XChange
  My Documents\\*.pdf
  PRINTER15:PASSTHROU
  PRINTER15:PASSTHROU
  PRINTER20:RAW

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-03 13:06   ` Chris McMahan
@ 2006-01-03 19:18     ` Eli Zaretskii
  2006-01-03 21:52       ` Lennart Borgman
       [not found]       ` <mailman.21297.1136325265.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-03 19:18 UTC (permalink / raw)


> From: Chris McMahan <first_initiallastname@one.dot.net>
> Date: Tue, 03 Jan 2006 08:06:53 -0500
> 
> Another alternative I just found recently is to use the program
> gsprint, which is included in the ghostview program you can find here:
> http://www.cs.wisc.edu/~ghost/

But this only works for PostScript printing, right?  I think we wanted
in this thread to find a more general solution, one which works for
both PostScript and non-PostScript (a-la "M-x lpr-region") printing.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-03 13:08 LENNART BORGMAN
@ 2006-01-03 19:20 ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-03 19:20 UTC (permalink / raw)


> Date: Tue, 03 Jan 2006 14:08:38 +0100
> From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
> Cc: help-gnu-emacs@gnu.org
> 
> > Thanks.  The question is, will this script find usable ports on
> > systems where people report they cannot find a port name that Emacs
> > can use?
> 
> If I run w32prn-customize I get an error. w32prn-default returns something like
> 
>   PDF-XChange
>   My Documents\\*.pdf
>   PRINTER15:PASSTHROU
>   PRINTER15:PASSTHROU
>   PRINTER20:RAW

What does the VB script display, when run?

Also, what does the function `default-printer-name' return on that
system?  It is supposed to do the equivalent of what the code posted
by Bruce does.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-03 19:18     ` Eli Zaretskii
@ 2006-01-03 21:52       ` Lennart Borgman
       [not found]       ` <mailman.21297.1136325265.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Lennart Borgman @ 2006-01-03 21:52 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>From: Chris McMahan <first_initiallastname@one.dot.net>
>>Date: Tue, 03 Jan 2006 08:06:53 -0500
>>
>>Another alternative I just found recently is to use the program
>>gsprint, which is included in the ghostview program you can find here:
>>http://www.cs.wisc.edu/~ghost/
>>    
>>
>
>But this only works for PostScript printing, right?  I think we wanted
>in this thread to find a more general solution, one which works for
>both PostScript and non-PostScript (a-la "M-x lpr-region") printing.
>  
>
A maybe small issue: GSview needs Microsoft Visual C++ for compilation. 
It does not compile with the GNU compilers.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]       ` <mailman.21297.1136325265.20277.help-gnu-emacs@gnu.org>
@ 2006-01-03 22:08         ` David Kastrup
  2006-01-03 22:12           ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: David Kastrup @ 2006-01-03 22:08 UTC (permalink / raw)


Lennart Borgman <lennart.borgman.073@student.lu.se> writes:

> Eli Zaretskii wrote:
>
>>>From: Chris McMahan <first_initiallastname@one.dot.net>
>>>Date: Tue, 03 Jan 2006 08:06:53 -0500
>>>
>>>Another alternative I just found recently is to use the program
>>>gsprint, which is included in the ghostview program you can find here:
>>>http://www.cs.wisc.edu/~ghost/
>>>    
>>
>>But this only works for PostScript printing, right?  I think we wanted
>>in this thread to find a more general solution, one which works for
>>both PostScript and non-PostScript (a-la "M-x lpr-region") printing.
>>  
>>
> A maybe small issue: GSview needs Microsoft Visual C++ for
> compilation. It does not compile with the GNU compilers.

GSview is not free software IIRC, anyway.  I don't know whether any
usable free PostScript viewer for Windows exists.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-03 22:08         ` David Kastrup
@ 2006-01-03 22:12           ` Lennart Borgman
  0 siblings, 0 replies; 119+ messages in thread
From: Lennart Borgman @ 2006-01-03 22:12 UTC (permalink / raw)
  Cc: help-gnu-emacs

David Kastrup wrote:

>Lennart Borgman <lennart.borgman.073@student.lu.se> writes:
>  
>
>GSview is not free software IIRC, anyway.  I don't know whether any
>usable free PostScript viewer for Windows exists.
>  
>
Since GSview for the purpose here does basically the same thing as a pdf 
viewer, then perhaps a pdf viewer can be used instead? (If the 
PostScript output is converted to pdf first of course.)

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-04  0:34 BRUCE INGALLS
  2006-01-04 10:00 ` Peter Dyballa
  0 siblings, 1 reply; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-04  0:34 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1427 bytes --]

>
> From: Peter Dyballa
> Date: Tue, 3 Jan 2006 10:44:15 +0100
> Subject: Re: Printing from WindowXP version of emacs
>
> > That said, yet another hack is available: there already is code to
> > export emacs buffers to PDF.
>
> Could you drop some names, please?


Feel free to browse http://EMacro.sf.net/ for more of this stuff.
I expect to make a new release, this month.
Here is the relevant code, from e-common.el:

;;Note that ps2pdf might not be installed
(defun save-current-buffer-as-pdf ()
  "Export pretty-printed file to PDF format."
  (interactive)
  (ps-print-buffer-with-faces (concat (buffer-file-name) ".ps"))
  (shell-command (concat "ps2pdf " (buffer-file-name) ".ps"))
  (delete-file (concat (buffer-file-name) ".ps"))
  (message "Done"))

(defvar cache-htmlize)            ;shut up compiler
(cache-locate-library
 use-cache 'cache-htmlize "htmlize"
 "To export as HTML, get htmlize.el from <url:
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el>")

(when cache-htmlize (require 'htmlize))

(when (or cache-htmlize (which "ps2pdf"))
  (easy-menu-change file-menu "Export As"
            (list
             ["PDF" save-current-buffer-as-pdf
              (if (which "ps2pdf") t nil)] ;enable only if in PATH
             ["HTML" htmlize-buffer
              (if cache-htmlize t nil)])))

;;note that cache-htmlize can be replaced by a slower call to
locate-library()

[-- Attachment #1.2: Type: text/html, Size: 2297 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-04  5:10 BRUCE INGALLS
  0 siblings, 0 replies; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-04  5:10 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 3079 bytes --]

Incidentally, Visual Basic Mode constantly gives me
Invalid regexp: "Invalid regular expression"
errors, when I simply try to hit the Enter key. I believe this is a
font-lock problem. Clues will be appreciated.

From: Eli Zaretskii
> Date: Tue, 03 Jan 2006 21:20:10 +0200


> > Thanks.  The question is, will this script find usable ports on
> > > systems where people report they cannot find a port name that Emacs
> > > can use?
> >
> > If I run w32prn-customize I get an error. w32prn-default returns
> something like
> >
> >   PDF-XChange
> >   My Documents\\*.pdf
> >   PRINTER15:PASSTHROU
> >   PRINTER15:PASSTHROU
> >   PRINTER20:RAW
>
> What does the VB script display, when run?


Looks like my alpha release needs some cleaning up.  Save the following code
as
getPrn.vbs, then run it with `cscript getPrn.vbs`
First, it should return your *default* printer port
Next, it dumps all the *generally* useful printer info I could find.
Is it fair to say that
   letter, legal, a1, b1
cover all the *common* paper sizes, that Emacs should support?

Let me know, if this new vbs script works. Perhaps I should post the updated
code on EmacsWiki, instead of gnu.emacs.sources.

rem --cut-here--

rem Copyright 2006 Bruce Ingalls. Licensed via GPL, http://www.gnu.org
rem Modified from
rem
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__printers_and_printing.asp
rem
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_printer.asp

strComputer = "."
rem note that " _" is line continuation
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where Default = True")
For Each objPrinter in colInstalledPrinters
    Wscript.Echo "Your printer port is"
    If objPrinter.Network then
       Wscript.Echo objPrinter.Name
       Wscript.Echo
       Wscript.Echo "server " + objPrinter.ServerName
    ElseIf objPrinter.Local then
       Wscript.Echo objPrinter.PortName
       Wscript.Echo
    End If

    Wscript.Echo "shareName " + objPrinter.ShareName
    Wscript.Echo "systemName " + objPrinter.SystemName

    For Each cap in objPrinter.CapabilityDescriptions
        Wscript.Echo "capabilities " + cap
    Next
    Wscript.Echo "status " + objPrinter.Status

rem Wscript.Echo "location " + objPrinter.Location

    For Each psize in objPrinter.PaperSizesSupported
        If psize = 7 then
           Wscript.Echo "letter size"
        ElseIf psize = 8 then
           Wscript.Echo "legal size"
        ElseIf psize = 19 then
           Wscript.Echo "A1 size"
        End If
    Next
    For Each paper in objPrinter.PrinterPaperNames
        Wscript.Echo "paper size " + paper
    Next

    If not objPrinter.ErrorCleared then
       Wscript.Echo objPrinter.Availability
       Wscript.Echo objPrinter.ErrorDescription
    End If
Next

rem --cut-here--

[-- Attachment #1.2: Type: text/html, Size: 5098 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-04  8:45 LENNART BORGMAN
  2006-01-04 18:22 ` Eli Zaretskii
  2006-01-05  1:17 ` BRUCE INGALLS
  0 siblings, 2 replies; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-04  8:45 UTC (permalink / raw)
  Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 8767 bytes --]

Unfortunately I get 

    C:\mydir\getPrn.vbs(22, 1) (null): 0x80041017

on the line 

    For Each objPrinter in colInstalledPrinters

I have a default printer, of course.
Content-Type: multipart/alternative; 
	boundary="----=_Part_22274_16488965.1136351435778"


------=_Part_22274_16488965.1136351435778
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Incidentally, Visual Basic Mode constantly gives me
Invalid regexp: "Invalid regular expression"
errors, when I simply try to hit the Enter key. I believe this is a
font-lock problem. Clues will be appreciated.

From: Eli Zaretskii
> Date: Tue, 03 Jan 2006 21:20:10 +0200


> > Thanks.  The question is, will this script find usable ports on
> > > systems where people report they cannot find a port name that Emacs
> > > can use?
> >
> > If I run w32prn-customize I get an error. w32prn-default returns
> something like
> >
> >   PDF-XChange
> >   My Documents\\*.pdf
> >   PRINTER15:PASSTHROU
> >   PRINTER15:PASSTHROU
> >   PRINTER20:RAW
>
> What does the VB script display, when run?


Looks like my alpha release needs some cleaning up.  Save the following cod=
e
as
getPrn.vbs, then run it with `cscript getPrn.vbs`
First, it should return your *default* printer port
Next, it dumps all the *generally* useful printer info I could find.
Is it fair to say that
   letter, legal, a1, b1
cover all the *common* paper sizes, that Emacs should support?

Let me know, if this new vbs script works. Perhaps I should post the update=
d
code on EmacsWiki, instead of gnu.emacs.sources.

rem --cut-here--

rem Copyright 2006 Bruce Ingalls. Licensed via GPL, http://www.gnu.org
rem Modified from
rem
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/wmisdk/w=
mi/wmi_tasks__printers_and_printing.asp
rem
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/wmisdk/w=
mi/win32_printer.asp

strComputer =3D "."
rem note that " _" is line continuation
Set objWMIService =3D GetObject("winmgmts:" _
    & "{impersonationLevel=3Dimpersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colInstalledPrinters =3D  objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where Default =3D True")
For Each objPrinter in colInstalledPrinters
    Wscript.Echo "Your printer port is"
    If objPrinter.Network then
       Wscript.Echo objPrinter.Name
       Wscript.Echo
       Wscript.Echo "server " + objPrinter.ServerName
    ElseIf objPrinter.Local then
       Wscript.Echo objPrinter.PortName
       Wscript.Echo
    End If

    Wscript.Echo "shareName " + objPrinter.ShareName
    Wscript.Echo "systemName " + objPrinter.SystemName

    For Each cap in objPrinter.CapabilityDescriptions
        Wscript.Echo "capabilities " + cap
    Next
    Wscript.Echo "status " + objPrinter.Status

rem Wscript.Echo "location " + objPrinter.Location

    For Each psize in objPrinter.PaperSizesSupported
        If psize =3D 7 then
           Wscript.Echo "letter size"
        ElseIf psize =3D 8 then
           Wscript.Echo "legal size"
        ElseIf psize =3D 19 then
           Wscript.Echo "A1 size"
        End If
    Next
    For Each paper in objPrinter.PrinterPaperNames
        Wscript.Echo "paper size " + paper
    Next

    If not objPrinter.ErrorCleared then
       Wscript.Echo objPrinter.Availability
       Wscript.Echo objPrinter.ErrorDescription
    End If
Next

rem --cut-here--

------=_Part_22274_16488965.1136351435778
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div><div>Incidentally, Visual Basic Mode constantly gives me<br>
Invalid regexp: &quot;Invalid regular expression&quot;<br>
errors, when I simply try to hit the Enter key. I believe this is a font-lo=
ck problem. Clues will be appreciated.<br>
</div><br><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid=
 rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">From: E=
li Zaretskii<br>Date: Tue, 03 Jan 2006 21:20:10 +0200</blockquote><br><bloc=
kquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, =
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; &gt; Thanks.&nbsp;&nbsp;The question is, will this script find usable =
ports on<br>&gt; &gt; systems where people report they cannot find a port n=
ame that Emacs<br>&gt; &gt; can use?<br>&gt;<br>&gt; If I run w32prn-custom=
ize I get an error. w32prn-default returns something like
<br>&gt;<br>&gt;&nbsp;&nbsp; PDF-XChange<br>&gt;&nbsp;&nbsp; My Documents\\=
*.pdf<br>&gt;&nbsp;&nbsp; PRINTER15:PASSTHROU<br>&gt;&nbsp;&nbsp; PRINTER15=
:PASSTHROU<br>&gt;&nbsp;&nbsp; PRINTER20:RAW<br><br>What does the VB script=
 display, when run?</blockquote><div><br>
Looks like my alpha release needs some cleaning up.&nbsp; Save the followin=
g code as<br>
getPrn.vbs, then run it with `cscript getPrn.vbs`<br>
First, it should return your *default* printer port<br>
Next, it dumps all the *generally* useful printer info I could find.<br>
Is it fair to say that <br>
&nbsp;&nbsp; letter, legal, a1, b1<br>
cover all the *common* paper sizes, that Emacs should support?<br>
<br>
Let me know, if this new vbs script works. Perhaps I should post the update=
d<br>
code on EmacsWiki, instead of gnu.emacs.sources.<br>
<br>
rem --cut-here--<br>
<br>
rem Copyright 2006 Bruce Ingalls. Licensed via GPL, <a href=3D"http://www.g=
nu.org">http://www.gnu.org</a><br>
rem Modified from<br>
rem <a href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library=
/en-us/wmisdk/wmi/wmi_tasks__printers_and_printing.asp">http://msdn.microso=
ft.com/library/default.asp?url=3D/library/en-us/wmisdk/wmi/wmi_tasks__print=
ers_and_printing.asp
</a><br>
rem <a href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library=
/en-us/wmisdk/wmi/win32_printer.asp">http://msdn.microsoft.com/library/defa=
ult.asp?url=3D/library/en-us/wmisdk/wmi/win32_printer.asp</a><br>
<br>
strComputer =3D &quot;.&quot;<br>
rem note that &quot; _&quot; is line continuation<br>
Set objWMIService =3D GetObject(&quot;winmgmts:&quot; _<br>
&nbsp;&nbsp;&nbsp; &amp; &quot;{impersonationLevel=3Dimpersonate}!\\&quot; =
_<br>
&nbsp;&nbsp;&nbsp; &amp; strComputer &amp; &quot;\root\cimv2&quot;)<br>
Set colInstalledPrinters =3D&nbsp; objWMIService.ExecQuery _<br>
&nbsp;&nbsp;&nbsp; (&quot;Select * from Win32_Printer Where Default =3D Tru=
e&quot;)<br>
For Each objPrinter in colInstalledPrinters<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;Your printer port is&quot;<br>
&nbsp;&nbsp;&nbsp; If objPrinter.Network then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.Name<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;server &quot; + obj=
Printer.ServerName<br>
&nbsp;&nbsp;&nbsp; ElseIf objPrinter.Local then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.PortName<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo <br>
&nbsp;&nbsp;&nbsp; End If<br>
<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;shareName &quot; + objPrinter.ShareNa=
me<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;systemName &quot; + objPrinter.System=
Name<br>
<br>
&nbsp;&nbsp;&nbsp; For Each cap in objPrinter.CapabilityDescriptions<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;capabilities =
&quot; + cap<br>
&nbsp;&nbsp;&nbsp; Next<br>
&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;status &quot; + objPrinter.Status<br>
<br>
rem Wscript.Echo &quot;location &quot; + objPrinter.Location<br>
<br>
&nbsp;&nbsp;&nbsp; For Each psize in objPrinter.PaperSizesSupported<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If psize =3D 7 then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &=
quot;letter size&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ElseIf psize =3D 8 then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &=
quot;legal size&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ElseIf psize =3D 19 then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &=
quot;A1 size&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>
&nbsp;&nbsp;&nbsp; Next<br>
&nbsp;&nbsp;&nbsp; For Each paper in objPrinter.PrinterPaperNames<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo &quot;paper size &q=
uot; + paper<br>
&nbsp;&nbsp;&nbsp; Next<br>
<br>
&nbsp;&nbsp;&nbsp; If not objPrinter.ErrorCleared then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.Availability<b=
r>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wscript.Echo objPrinter.ErrorDescripti=
on<br>
&nbsp;&nbsp;&nbsp; End If<br>
Next<br>
<br>
rem --cut-here--<br>
</div></div>

------=_Part_22274_16488965.1136351435778--

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-04  0:34 BRUCE INGALLS
@ 2006-01-04 10:00 ` Peter Dyballa
  2006-01-05  1:56   ` BRUCE INGALLS
  0 siblings, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2006-01-04 10:00 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 04.01.2006 um 01:34 schrieb BRUCE INGALLS:

> (defun save-current-buffer-as-pdf ()

Hello Bruce!

Your site in German is quite funny -- somehow the words look familiar  
to me, but the sentences built from them ... am I reading the wrong  
newspapers and magazines that they don't make much sense to me? Which  
machine tried to "translate" the original texts?


You are using the usual ps-print functions and then ps2pdf to convert  
PS output to PDF. This is OK for US-ASCII and ISO Latin-1/ISO 8859-1,  
but it fails already in ISO Latin-9/ISO 8859-15, ISO Latin with €. It  
works for almost 200 characters, but there are 60,000 more in Unicode  
(BMP).

htmlize.el is a great tool, yes! It seems that it converts every  
textual buffer contents in any encoding without errors to Unicode  
(UTF-8) preserving text attributes in HTML. Together with htmlize- 
view.el, which opens the 'printed' buffer in the default Internet  
browser, one gets access to the system's native printing dialogues  
(printer choice, paper format, ...) and mechanisms and does not need  
to take care of any font issues for characters outside the small US- 
ASCII/ISO Latin world. For 'Carbon Emacs' on Mac OS X this seems to  
become the standard printing interface ... although some users and  
developers seem to have a 'strange' feeling when using this! And it  
does not need third party software (ps2pdf from Ghostview).

--
Greetings

   Pete

The mathematician who pursues his studies without clear views of this  
matter, must often have the uncomfortable feeling that his paper and  
pencil surpass him in intelligence. (Ernst Mach)

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-04  8:45 LENNART BORGMAN
@ 2006-01-04 18:22 ` Eli Zaretskii
  2006-01-04 19:14   ` Lennart Borgman
  2006-01-05  1:17 ` BRUCE INGALLS
  1 sibling, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-04 18:22 UTC (permalink / raw)


> Date: Wed, 04 Jan 2006 09:45:10 +0100
> From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
> Cc: help-gnu-emacs@gnu.org
> 
> Unfortunately I get 
> 
>     C:\mydir\getPrn.vbs(22, 1) (null): 0x80041017
> 
> on the line 
> 
>     For Each objPrinter in colInstalledPrinters

Is that the one and only line it prints?  If not, what do other lines
say?

Also, I asked to see what does default-printer-name return on that
platform.  It's a Windows-specific function that is supposed to do
something similar to Bruce's VB script.  Can you tell what is its
result on that system?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-04 18:22 ` Eli Zaretskii
@ 2006-01-04 19:14   ` Lennart Borgman
  0 siblings, 0 replies; 119+ messages in thread
From: Lennart Borgman @ 2006-01-04 19:14 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Date: Wed, 04 Jan 2006 09:45:10 +0100
>>From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
>>Cc: help-gnu-emacs@gnu.org
>>
>>Unfortunately I get 
>>
>>    C:\mydir\getPrn.vbs(22, 1) (null): 0x80041017
>>
>>on the line 
>>
>>    For Each objPrinter in colInstalledPrinters
>>    
>>
>
>Is that the one and only line it prints?  If not, what do other lines
>say?
>  
>
Yes.

>Also, I asked to see what does default-printer-name return on that
>platform.  It's a Windows-specific function that is supposed to do
>something similar to Bruce's VB script.  Can you tell what is its
>result on that system?
>
Sorry, I know I forgot that. Coming back tomorrow about that.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-04  8:45 LENNART BORGMAN
  2006-01-04 18:22 ` Eli Zaretskii
@ 2006-01-05  1:17 ` BRUCE INGALLS
  1 sibling, 0 replies; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-05  1:17 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/4/06, LENNART BORGMAN

> Unfortunately I get
>
>     C:\mydir\getPrn.vbs(22, 1) (null): 0x80041017
>
> on the line
>
>     For Each objPrinter in colInstalledPrinters
>
> I have a default printer, of course.

Well, that part is Microsoft's code. If you check the URL I provided,
in the comments at the top:
Windows 2000/NT and Windows 98/95:  The Default property is  not available

I tested it on XP. What version of Windows are you using?
Try removing the "Where Default = True" at top.
I noticed that only the default printer had a ShareName.

...

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-04 10:00 ` Peter Dyballa
@ 2006-01-05  1:56   ` BRUCE INGALLS
  2006-01-05 13:01     ` Peter Dyballa
  0 siblings, 1 reply; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-05  1:56 UTC (permalink / raw)
  Cc: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 1634 bytes --]

On 1/4/06, Peter Dyballa <Peter_Dyballa@web.de> wrote:
>
>
> Am 04.01.2006 um 01:34 schrieb BRUCE INGALLS:
>
> > (defun save-current-buffer-as-pdf ()
>
> Hello Bruce!
> Your site in German is quite funny


I don't remember how I translated the pages, but I do know that they need
more work. Perhaps I should leave everything in English, but I am trying to
accomodate the rest of the world.
If you have suggestions, I am open. I have asked for volunteers in the
past...

>
> You are using the usual ps-print functions and then ps2pdf to convert
> PS output to PDF. This is OK for US-ASCII and ISO Latin-1/ISO 8859-1,
> but it fails already in ISO Latin-9/ISO 8859-15, ISO Latin with €.


Thanks for the info. I wonder if the shortcoming is in the PS generation, or
in the PDF conversion. I'm sure you could `gsview foo.ps` to find out.

htmlize.el is a great tool, yes!


For 'Carbon Emacs' on Mac OS X this seems to
> become the standard printing interface ... although some users and
> developers seem to have a 'strange' feeling when using this! And it
> does not need third party software (ps2pdf from Ghostview).


Well, it did not take much convincing, to tell me that ps2pdf is not a good
solution.
Unfortunately, while the htmlview.el printing approach is appealing, it does
rely on 3rd party software, namely the web browser (unless you use the
lower quality w3.el, which is an optional package).

Fortunately, w32, osx & linux/gnome have default browsers, that Emacs
can detect. I have included browser detection software in EMacro (ach, weh!)
which can help with console mode and other platforms, such as Solaris, bsd,
etc.

[-- Attachment #1.2: Type: text/html, Size: 2469 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                                       ` <mailman.20871.1135945105.20277.help-gnu-emacs@gnu.org>
@ 2006-01-05  6:53                                         ` Ilya Zakharevich
  2006-01-05 16:39                                           ` Eli Zaretskii
       [not found]                                           ` <mailman.21485.1136479302.20277.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 119+ messages in thread
From: Ilya Zakharevich @ 2006-01-05  6:53 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.20871.1135945105.20277.help-gnu-emacs@gnu.org>:
> > Nonsense.  I'm discussing the input format of this pipe, not the input
> > format of the printer.

> Please re-read my answer: it _was_ about the input format of the
> pipe.  I said that you need not bother about the details you were
> asking about.

You saying this does not make it valid.  How are you going to order
pizza by phone if you do not know what language the operator speaks?

> > There is no "current locale".  You probably mean "current codepage";

> If you insist that there's no "current locale" on Windows, please
> spell out the difference between it and the "current codepage", on
> Windows.

I know very little about Win*.  However, on DOSISH systems, all that
codepages govern is 8bit-codepoint-to-character translations (and
back) (here by "character" I mean something similar to Unicode
codepoint).  Locales govern many other things too.

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-05  9:24 LENNART BORGMAN
  2006-01-05 16:43 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-05  9:24 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> Also, I asked to see what does default-printer-name return on that
> platform.  It's a Windows-specific function that is supposed to do
> something similar to Bruce's VB script.  Can you tell what is its
> result on that system?

(default-printer-name) returns \\host-name\1234567890

where host-name is the name where the printer queue is.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05  1:56   ` BRUCE INGALLS
@ 2006-01-05 13:01     ` Peter Dyballa
  2006-01-05 15:41       ` Lennart Borgman
  2006-01-05 20:44       ` Eli Zaretskii
  0 siblings, 2 replies; 119+ messages in thread
From: Peter Dyballa @ 2006-01-05 13:01 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 05.01.2006 um 02:56 schrieb BRUCE INGALLS:

>> You are using the usual ps-print functions and then ps2pdf to convert
>> PS output to PDF. This is OK for US-ASCII and ISO Latin-1/ISO 8859-1,
>> but it fails already in ISO Latin-9/ISO 8859-15, ISO Latin with €.
>
> Thanks for the info. I wonder if the shortcoming is in the PS  
> generation, or
> in the PDF conversion. I'm sure you could `gsview foo.ps` to find out.

The problem is encoding of the PostScript fonts used to set the  
document. ps-print.el uses ISO 8859-1, independent from the buffer  
contents' encoding. If you have a buffer contents that uses more than  
192 different characters (256 less two times 32 control characters, 7  
bit and 8 bit), you need to provide special PostScript fonts that  
encode so many characters (CID coded fonts for CJK use), or use the  
same font with different encodings to have Latin plus some extended  
Latin (a technique that's used in TeX). The final step of converting  
PS to PDF only fixes these limitations, it can't change anything  
since it's still PostScript. It's just of an improved structure  
embedding all fonts used in the document (leaving out a set of  
mandatory PS fonts) and this way giving a guarantee that this  
document will print everywhere and exactly the same.

>
>> htmlize.el is a great tool, yes!
>>
>> For 'Carbon Emacs' on Mac OS X this seems to
>> become the standard printing interface ... although some users and
>> developers seem to have a 'strange' feeling when using this! And it
>> does not need third party software (ps2pdf from Ghostview).
>
> Well, it did not take much convincing, to tell me that ps2pdf is  
> not a good
> solution.
> Unfortunately, while the htmlview.el printing approach is  
> appealing, it does
> rely on 3rd party software, namely the web browser (unless you use the
> lower quality w3.el, which is an optional package).
>
> Fortunately, w32, osx & linux/gnome have default browsers, that Emacs
> can detect. I have included browser detection software in EMacro  
> (ach, weh!)
> which can help with console mode and other platforms, such as  
> Solaris, bsd,
> etc.

I never worked on a BSD UNIX other than SunOS or Mac OS X, but I  
can't imagine that FreeBSD or NetBSD come without a (kind of third  
party) browser on their installation disks, and OpenBSD is secure  
enough that it can afford an Internet browser. They probably have  
Mozilla, Firefox, Seamonkey well integrated as a native application.  
Solaris once had HotJava (and OpenWindows) and now uses GNOME as GUI,  
so it could be viewed as a Linux variant. AIX, Irix and HP-UX will  
have some sort of Internet browser provided by the manufacturer too.  
A somehow improved version of printing a htmlize'd buffer or  
selection contents could be to use print engines in KDE or GNOME,  
which probably exist. In Mac OS X 10.2 ("Jaguar") Apple 'contributed'  
kind of a generic 'convertor' for CUPS to convert different input  
formats (JPEG, GIF, PICT, TIFF, RTF, plain text in MacRoman) to PDF  
(or PS):

	Usage: /System/Library/Printers/Libraries/convert [-f <input  
filename>] [-o <output filename>] [-i <input mimetype>] [-j <output  
mimetype>] [-P <PPD filename>] [-u] [-a <attribute string>] [-U  
<username>] [-J <jobname] [-c <copies>] [-D]

convert can optimise its PS or PDF output for the printer used via  
the PPD file, it even uses the user's system default monospaced font  
-- but only accepted plain text input is MacRoman! And it has to be a  
file -- no pipe allowed! To convert other text encodings you would  
have to use lossy iconv -c (otherwise no output at all!) to a file  
and feed this file to convert. But -- htmlize'ing first, convert now  
makes no fault with "-i text/html" and everything is printed fine!  
(Some optimisation in fonts and sizes might be fine, in a personal  
CSS file.) Using this 'Unicode encoded' HTML file all is preserved:  
the font used in Emacs, the font faces, its colours (the line breaks  
are not great yet). All that's needed is an efficient convertor from  
HTML to the printing systems native input format ... and maybe a  
button to open the system's native print dialogue!

--
Greetings

   Pete

I obviously had too much to dream last night ...

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 13:01     ` Peter Dyballa
@ 2006-01-05 15:41       ` Lennart Borgman
  2006-01-05 21:17         ` Peter Dyballa
  2006-01-05 20:44       ` Eli Zaretskii
  1 sibling, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2006-01-05 15:41 UTC (permalink / raw)
  Cc: help-gnu-emacs

Peter Dyballa wrote:

>                   
> The problem is encoding of the PostScript fonts used to set the  
> document. ps-print.el uses ISO 8859-1, independent from the buffer  
> contents' encoding. If you have a buffer contents that uses more than  
> 192 different characters (256 less two times 32 control characters, 7  
> bit and 8 bit), you need to provide special PostScript fonts that  
> encode so many characters (CID coded fonts for CJK use), or use the  
> same font with different encodings to have Latin plus some extended  
> Latin (a technique that's used in TeX).

It is not clear to me whether you mean that this is a bug in ps-print.el 
or that it is a limitation in the current handling of fonts in 
PostScript. I am sorry that I do not understand this yet, but can you 
explain the status of this again?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05  6:53                                         ` Ilya Zakharevich
@ 2006-01-05 16:39                                           ` Eli Zaretskii
       [not found]                                           ` <mailman.21485.1136479302.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-05 16:39 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Thu, 5 Jan 2006 06:53:30 +0000 (UTC)
> Bcc: ilya@gnu.org
> 
> [A complimentary Cc of this posting was sent to
> Eli Zaretskii 
> <eliz@gnu.org>], who wrote in article <mailman.20871.1135945105.20277.help-gnu-emacs@gnu.org>:
> > > Nonsense.  I'm discussing the input format of this pipe, not the input
> > > format of the printer.
> 
> > Please re-read my answer: it _was_ about the input format of the
> > pipe.  I said that you need not bother about the details you were
> > asking about.
> 
> You saying this does not make it valid.  How are you going to order
> pizza by phone if you do not know what language the operator speaks?

I don't order pizza, so I don't need to worry.

> > > There is no "current locale".  You probably mean "current codepage";
> 
> > If you insist that there's no "current locale" on Windows, please
> > spell out the difference between it and the "current codepage", on
> > Windows.
> 
> I know very little about Win*.  However, on DOSISH systems, all that
> codepages govern is 8bit-codepoint-to-character translations (and
> back) (here by "character" I mean something similar to Unicode
> codepoint).

No, DOS codepages governed only the codepoint-to-font translations.

> Locales govern many other things too.

Current Windows systems are much closer to the Posix locales than
MS-DOS ever was.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05  9:24 LENNART BORGMAN
@ 2006-01-05 16:43 ` Eli Zaretskii
  2006-01-05 21:01   ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-05 16:43 UTC (permalink / raw)


> Date: Thu, 05 Jan 2006 10:24:35 +0100
> From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
> Cc: help-gnu-emacs@gnu.org
> 
> (default-printer-name) returns \\host-name\1234567890
> 
> where host-name is the name where the printer queue is.

And using this in Emacs as the value of `printer-name' (after escaping
the backslashes) fails to produce the printed matter, is that right?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 13:01     ` Peter Dyballa
  2006-01-05 15:41       ` Lennart Borgman
@ 2006-01-05 20:44       ` Eli Zaretskii
  2006-01-05 21:18         ` Peter Dyballa
  1 sibling, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-05 20:44 UTC (permalink / raw)


> From: Peter Dyballa <Peter_Dyballa@web.de>
> Date: Thu, 5 Jan 2006 14:01:10 +0100
> Cc: help-gnu-emacs@gnu.org
> 
> The problem is encoding of the PostScript fonts used to set the  
> document. ps-print.el uses ISO 8859-1, independent from the buffer  
> contents' encoding.

I don't think this is true.  First, there's ps-mule.el that can be set
up to use other 8-bit encodings instead of 8859-1, if your printer has
the appropriate fonts loaded.  And second, you can install BDF fonts
for other character sets and set up ps-mule and ps-print for printing
almost any character set imaginable.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 16:43 ` Eli Zaretskii
@ 2006-01-05 21:01   ` Lennart Borgman
  2006-01-06  9:09     ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2006-01-05 21:01 UTC (permalink / raw)
  Cc: help-gnu-emacs

Eli Zaretskii wrote:

>>Date: Thu, 05 Jan 2006 10:24:35 +0100
>>From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
>>Cc: help-gnu-emacs@gnu.org
>>
>>(default-printer-name) returns \\host-name\1234567890
>>
>>where host-name is the name where the printer queue is.
>>    
>>
>
>And using this in Emacs as the value of `printer-name' (after escaping
>the backslashes) fails to produce the printed matter, is that right?
>
Ehum, I did not test because it looks so very strange. I will try it 
next week. Do you really expect something like that to work? I mean it 
is exactly those figures I wrote above.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 15:41       ` Lennart Borgman
@ 2006-01-05 21:17         ` Peter Dyballa
  2006-01-06  8:39           ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2006-01-05 21:17 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 05.01.2006 um 16:41 schrieb Lennart Borgman:

> Peter Dyballa wrote:
>
>>                   The problem is encoding of the PostScript fonts  
>> used to set the  document. ps-print.el uses ISO 8859-1,  
>> independent from the buffer  contents' encoding. If you have a  
>> buffer contents that uses more than  192 different characters (256  
>> less two times 32 control characters, 7  bit and 8 bit), you need  
>> to provide special PostScript fonts that  encode so many  
>> characters (CID coded fonts for CJK use), or use the  same font  
>> with different encodings to have Latin plus some extended  Latin  
>> (a technique that's used in TeX).
>
> It is not clear to me whether you mean that this is a bug in ps- 
> print.el or that it is a limitation in the current handling of  
> fonts in PostScript. I am sorry that I do not understand this yet,  
> but can you explain the status of this again?

It is both! ps-print.el destroys the original encoding, and PS  
usually handles font encodings with up to 256 mappings. (And ps- 
print.el has no code to handle CID encoded fonts with up to 64 K  
mappings.)

--
Greetings

   Pete       (:
         _    / __    -    -
       _/ \__/_/        -     -
      (´`)      (´`)   -    -
       `´        `´

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 20:44       ` Eli Zaretskii
@ 2006-01-05 21:18         ` Peter Dyballa
  2006-01-06  8:36           ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2006-01-05 21:18 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 05.01.2006 um 21:44 schrieb Eli Zaretskii:

>> The problem is encoding of the PostScript fonts used to set the
>> document. ps-print.el uses ISO 8859-1, independent from the buffer
>> contents' encoding.
>
> I don't think this is true.  First, there's ps-mule.el that can be set
> up to use other 8-bit encodings instead of 8859-1, if your printer has
> the appropriate fonts loaded.  And second, you can install BDF fonts
> for other character sets and set up ps-mule and ps-print for printing
> almost any character set imaginable.

I don't want to print bitmaps. I have a genuine PostScript 3 printer.

--
Greetings

   Pete

These are my principles and if you don't like them... well, I have  
others. - Groucho Marx

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 21:18         ` Peter Dyballa
@ 2006-01-06  8:36           ` Eli Zaretskii
  2006-01-06 11:59             ` Peter Dyballa
  0 siblings, 1 reply; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-06  8:36 UTC (permalink / raw)


> Cc: help-gnu-emacs@gnu.org
> From: Peter Dyballa <Peter_Dyballa@Web.DE>
> Date: Thu, 5 Jan 2006 22:18:42 +0100
> 
> Am 05.01.2006 um 21:44 schrieb Eli Zaretskii:
> 
> >> The problem is encoding of the PostScript fonts used to set the
> >> document. ps-print.el uses ISO 8859-1, independent from the buffer
> >> contents' encoding.
> >
> > I don't think this is true.  First, there's ps-mule.el that can be set
> > up to use other 8-bit encodings instead of 8859-1, if your printer has
> > the appropriate fonts loaded.  And second, you can install BDF fonts
> > for other character sets and set up ps-mule and ps-print for printing
> > almost any character set imaginable.
> 
> I don't want to print bitmaps. I have a genuine PostScript 3 printer.

``Don't want'' and ``doesn't work'' are two different things, you
know.  Your message to which I replied made it sound like Emacs
PostScript printing is broken for anything but Latin-1.  Which is
clearly not true.  All one needs is download and install the GNU
Intlfonts package and customize a few variables as documented in
ps-mule.el.  In addition to BDF fonts, there are Type1 and TrueType
fonts in that package.

Also, if you set up ps-mule.el to use non-ASCII fonts supported by
your printer, the printouts you will get will be as pretty as pure
ASCII, the fonts from Intlfonts are only used for characters not
covered by the printer's built-in fonts.

As for bitmaps, back when I looked into this, work was being done on
writing ps-type1.el which, like ps-bdf.el for BDF, was supposed to let
ps-print use Type1 fonts.  I don't know if this work was finished, but
if it wasn't, I'd suggest that people who are interested in enhancing
Emacs printing capabilities to work on Type1 and TrueType fonts,
instead of preaching that we delegate printing to IE.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 21:17         ` Peter Dyballa
@ 2006-01-06  8:39           ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-06  8:39 UTC (permalink / raw)


> From: Peter Dyballa <Peter_Dyballa@web.de>
> Date: Thu, 5 Jan 2006 22:17:22 +0100
> Cc: help-gnu-emacs@gnu.org
> 
> > It is not clear to me whether you mean that this is a bug in ps- 
> > print.el or that it is a limitation in the current handling of  
> > fonts in PostScript. I am sorry that I do not understand this yet,  
> > but can you explain the status of this again?
> 
> It is both! ps-print.el destroys the original encoding, and PS  
> usually handles font encodings with up to 256 mappings. (And ps- 
> print.el has no code to handle CID encoded fonts with up to 64 K  
> mappings.)

Would you please stop spreading incorrect information?  Emacs includes
ps-mule.el, which is an add-on to ps-print that allows Emacs to print
any characters supported by Emacs on a PostScript printer.  Perhaps
you should look at the code before you talk about what is and what
isn't a bug there.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-05 21:01   ` Lennart Borgman
@ 2006-01-06  9:09     ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-06  9:09 UTC (permalink / raw)


> Date: Thu, 05 Jan 2006 22:01:16 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: help-gnu-emacs@gnu.org
> 
> Eli Zaretskii wrote:
> 
> >>Date: Thu, 05 Jan 2006 10:24:35 +0100
> >>From: LENNART BORGMAN <lennart.borgman.073@student.lu.se>
> >>Cc: help-gnu-emacs@gnu.org
> >>
> >>(default-printer-name) returns \\host-name\1234567890
> >>
> >>where host-name is the name where the printer queue is.
> >>    
> >>
> >
> >And using this in Emacs as the value of `printer-name' (after escaping
> >the backslashes) fails to produce the printed matter, is that right?
> >
> Ehum, I did not test because it looks so very strange. I will try it 
> next week. Do you really expect something like that to work? I mean it 
> is exactly those figures I wrote above.

Do you mean that you already tried to use \\host-name\1234567890, the
value returned by (default-printer-name), as the value of
`printer-name', and it failed?  If so, then of course trying again the
same thing would be unnecessary.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-06  8:36           ` Eli Zaretskii
@ 2006-01-06 11:59             ` Peter Dyballa
  2006-01-06 14:07               ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Peter Dyballa @ 2006-01-06 11:59 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 06.01.2006 um 09:36 schrieb Eli Zaretskii:

> All one needs is download and install the GNU
> Intlfonts package and customize a few variables as documented in
> ps-mule.el.  In addition to BDF fonts, there are Type1 and TrueType
> fonts in that package.

These fonts are a mess of patches with holes in them. I do not  
recommend to use them, except, one uses found rubber parts instead of  
tyres around one's car's rims because the tyres were needed to build  
one's shoes, sandal type, from.

The PS or TT fonts come from the old TeX Omega project. In recent TeX  
you can find more and more complete fonts (meanwhile we are writing  
the year 2006, it's in the third millennium now).

And I know what I am writing since I have them installed, since I use  
them still in some Carbon Emacsen (some variants are handicapped from  
inadequate and proprietary decisions in last millennium), since I  
used them in GNU Emacs 22 which now has a basis of complicated  
fontsets from mostly mono-spaced Unicode encoded TrueType fonts --  
from time to time I still see glyphs from the GNU Intlfonts! Fighting  
with these fontset definitions brings much more pleasing results than  
using this given up and incomplete work-around.


There is probably good reason that ps-type1.el is not included in GNU  
Emacs.

And I am sure this decision is not based on the existence of  
htmlize.el. Which looks more like a perfect work-around for something  
missing in GNU Emacs, or, in other words, like a solution for a since  
long existing problem.

--
Greetings

   Pete

To be is to do.
                        -- I. Kant
To do is to be.
                        -- A. Sartre
Yabba-Dabba-Doo!
                        -- F. Flintstone

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-06 11:59             ` Peter Dyballa
@ 2006-01-06 14:07               ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-06 14:07 UTC (permalink / raw)


> Cc: help-gnu-emacs@gnu.org
> From: Peter Dyballa <Peter_Dyballa@Web.DE>
> Date: Fri, 6 Jan 2006 12:59:28 +0100
> 
> 
> Am 06.01.2006 um 09:36 schrieb Eli Zaretskii:
> 
> > All one needs is download and install the GNU
> > Intlfonts package and customize a few variables as documented in
> > ps-mule.el.  In addition to BDF fonts, there are Type1 and TrueType
> > fonts in that package.
> 
> These fonts are a mess of patches with holes in them. I do not  
> recommend to use them, except, one uses found rubber parts instead of  
> tyres around one's car's rims because the tyres were needed to build  
> one's shoes, sandal type, from.

I don't know what you are talking about.  I don't maintain Intlfonts,
I just used them when I needed to print text that my printer didn't
support with its fonts.  I got quite readable text, but perhaps I'm
not as knowledgeable as you are about font design.

Also note that Intlfonts were originally meant for use in display, not
in ps-print.  Later ps-mule and ps-bdf were added to use PostScript
commands to download the fonts to the printer before printing text.

In any case, the right thing to do about bad fonts that Emacs users
are recommended to use is to volunteer to improve them.  Until then,
Intlfonts is the best collection of free fonts we know about (if you
know otherwise, please suggest better alternatives, so that we could
mention them in the Emacs installation instructions).

> There is probably good reason that ps-type1.el is not included in GNU  
> Emacs.

The only reason I know of is that it never got finished.

> And I am sure this decision is not based on the existence of  
> htmlize.el. Which looks more like a perfect work-around for something  
> missing in GNU Emacs, or, in other words, like a solution for a since  
> long existing problem.

Sorry, can't parse this.  Perhaps my English is not good enough.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-07  5:00 BRUCE INGALLS
  2006-01-07  9:18 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-07  5:00 UTC (permalink / raw)


> > Date: Thu, 05 Jan 2006 22:01:16 +0100
> > From: Lennart Borgman
> >
> > >>(default-printer-name) returns \\host-name\1234567890
> > >>

> > Ehum, I did not test because it looks so very strange. I will try it
> > next week. Do you really expect something like that to work? I mean it
> > is exactly those figures I wrote above.

That sure does not look right. Here's how you can test it, from the
Windows command line:
  net view \\host-name
  print /D:\\host-name\1234567890 file.txt

I found a bug in the getPrn.vbs I had emailed, where it did not return
the proper network printer port. Here is the essential getPrn.vbs,
with the fix:

REM --begin--

strComputer = "."
rem note that " _" is line continuation
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where Default = True")
rem    ("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
    Wscript.Echo "Your printer port is"
    If objPrinter.Network then
       Wscript.Echo objPrinter.ServerName + "\" + objPrinter.ShareName
       Wscript.Echo
    ElseIf objPrinter.Local then
       Wscript.Echo objPrinter.PortName
       Wscript.Echo
    End If
Next

REM --end--

Save the above as getPrn2.vbs, and run
  cscript getPrn2.vbs

If the output from this script does not `net view`, nor `print`, then
some sys admin is in order, because it tested fine for me.
At that point, `net help`, `net use help`, and control panel are your friends.

OTOH, if this does work, I'd say we are ready to write some elisp
code, and user docs.
I suggest that this be written as a M-x Customize plugin (pardon my
fast & loose terms), with htmlize-view as the default (assuming it can
be found in load-path, and Emacs is currently in GUI mode), then
postscript, if gsview is in the path, then finally, plain text.
There is a way to use WMI (see getPrn.vbs code, and its URIs) to query
for PostScript support, but I could not get it to work reliably.

If this approach for Windows code meets consensus, I intend to move on
to working with Linux/OSX/Cygwin printing. I would need help testing,
however, as my hardware variety is limited.

Incidentally, does htmlize-view.el work well with Lynx or (e)links?
Beyond console mode, is w3.el (or w3m?) an adequate fallback?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-07  5:00 BRUCE INGALLS
@ 2006-01-07  9:18 ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-07  9:18 UTC (permalink / raw)


> Date: Sat, 7 Jan 2006 00:00:24 -0500
> From: BRUCE INGALLS <bruce.ingalls@gmail.com>
> 
> > > Date: Thu, 05 Jan 2006 22:01:16 +0100
> > > From: Lennart Borgman
> > >
> > > >>(default-printer-name) returns \\host-name\1234567890
> > > >>
> 
> > > Ehum, I did not test because it looks so very strange. I will try it
> > > next week. Do you really expect something like that to work? I mean it
> > > is exactly those figures I wrote above.
> 
> That sure does not look right.

What doesn't look right, exactly?  I took the above as a template, not
as a literal string that is the printer's name.  If it's a literal
string, then it is indeed strange, but default-printer-name simply
calls GetProfileString and GetPrinter APIs, so whatever those return,
it's the system's notion of the printer.  Unless there's a bug in
default-printer-name, in which case please step through it and tell
what goes wrong there.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
       [not found]                                           ` <mailman.21485.1136479302.20277.help-gnu-emacs@gnu.org>
@ 2006-01-07 12:02                                             ` Ilya Zakharevich
  2006-01-07 12:55                                               ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: Ilya Zakharevich @ 2006-01-07 12:02 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Eli Zaretskii 
<eliz@gnu.org>], who wrote in article <mailman.21485.1136479302.20277.help-gnu-emacs@gnu.org>:
> > I know very little about Win*.  However, on DOSISH systems, all that
> > codepages govern is 8bit-codepoint-to-character translations (and
> > back) (here by "character" I mean something similar to Unicode
> > codepoint).

> No, DOS codepages governed only the codepoint-to-font translations.

Please do not discuss topics you know nothing about.  Thanks.

Yours,
Ilya

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-07 12:02                                             ` Ilya Zakharevich
@ 2006-01-07 12:55                                               ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-07 12:55 UTC (permalink / raw)


> From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
> Date: Sat, 7 Jan 2006 12:02:00 +0000 (UTC)
> Bcc: ilya@gnu.org
> Originator: ilya@powdermilk.math.berkeley.edu
> 
> > > I know very little about Win*.  However, on DOSISH systems, all that
> > > codepages govern is 8bit-codepoint-to-character translations (and
> > > back) (here by "character" I mean something similar to Unicode
> > > codepoint).
> 
> > No, DOS codepages governed only the codepoint-to-font translations.
> 
> Please do not discuss topics you know nothing about.

Likewise.

This isn't a discussion, anyway, you just want to show off your
so-called ``knowledge'' while at the same time denigrating anyone who
happens to disagree, or God forbid fails to live up to your ridiculous
standards.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-08  1:06 BRUCE INGALLS
  2006-01-08  4:12 ` Eli Zaretskii
  0 siblings, 1 reply; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-08  1:06 UTC (permalink / raw)


> From: Eli Zaretskii
> Date: Sat, 07 Jan 2006 11:18:43 +0200
> Subject:
> > Date: Sat, 7 Jan 2006 00:00:24 -0500
> > > > Date: Thu, 05 Jan 2006 22:01:16 +0100
> > > > From: Lennart Borgman
> > > >
> > > > >>(default-printer-name) returns \\host-name\1234567890
> > > >... Do you really expect something like that to work? I mean it
> > > > is exactly those figures I wrote above.
> >
> > That sure does not look right.
>
> What doesn't look right, exactly?  I took the above as a template, not
> as a literal string that is the printer's name.  If it's a literal
> string, then it is indeed strange, but default-printer-name simply
> calls GetProfileString and GetPrinter APIs, so whatever those return,
> it's the system's notion of the printer.  Unless there's a bug in
> default-printer-name, in which case please step through it and tell
> what goes wrong there.

Agreed. Lennart did say "exactly".
I did not realize that Emacs already had w32 default-printer code.
Does anyone know, or can provide suggestions for default printers for
other platforms, such as mac osx, gnome, kde?
Do the alpha releases of Emacs on w32 set printer-name to default-printer-name?
If so, then w32 printing should already be easy. As per this thread,
all that should remain, is to set a printing-method customize variable
for plain/postscript/ghostscript/htmlize-view, and to make it go.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-08  1:06 BRUCE INGALLS
@ 2006-01-08  4:12 ` Eli Zaretskii
  0 siblings, 0 replies; 119+ messages in thread
From: Eli Zaretskii @ 2006-01-08  4:12 UTC (permalink / raw)


> Date: Sat, 7 Jan 2006 20:06:03 -0500
> From: BRUCE INGALLS <bruce.ingalls@gmail.com>
> 
> I did not realize that Emacs already had w32 default-printer code.
> Does anyone know, or can provide suggestions for default printers for
> other platforms, such as mac osx, gnome, kde?

Other platforms, at least those which are Posix-compliant, don't need
to set printer-name, they need to set lpr-program and (optionally)
ps-lpr-program, because on those platforms you simply pipe the text to
a program which then takes care of spooling and printing.
printer-name was invented for MS-DOS and MS-Windows.

> Do the alpha releases of Emacs on w32 set printer-name to default-printer-name?

Yes; see dos-w32.el.  Unless the user customizes printer-name, the
result of default-printer-name is used.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-09  8:29 LENNART BORGMAN
  2006-01-09 11:42 ` Lennart Borgman
  0 siblings, 1 reply; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-09  8:29 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: Eli Zaretskii <eliz@gnu.org>

> > Date: Sat, 7 Jan 2006 00:00:24 -0500
> > From: BRUCE INGALLS <bruce.ingalls@gmail.com>
> > 
> > > > Date: Thu, 05 Jan 2006 22:01:16 +0100
> > > > From: Lennart Borgman
> > > >
> > > > >>(default-printer-name) returns \\host-name\1234567890
> > > > >>
> > 
> > > > Ehum, I did not test because it looks so very strange. I 
> will try it
> > > > next week. Do you really expect something like that to work? 
> I mean it
> > > > is exactly those figures I wrote above.
> > 
> > That sure does not look right.
> 
> What doesn't look right, exactly?  I took the above as a template, not
> as a literal string that is the printer's name.  If it's a literal
> string, then it is indeed strange, but default-printer-name simply
> calls GetProfileString and GetPrinter APIs, so whatever those return,
> it's the system's notion of the printer.  Unless there's a bug in
> default-printer-name, in which case please step through it and tell
> what goes wrong there.

I have felt a bit nervous over the weekend. Did I really test this with -Q? Or is it something long forgotten I have in my initialization files.

I tried again with -Q. And yes, it is literally the share name I told ("1234567890").

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-09  8:29 LENNART BORGMAN
@ 2006-01-09 11:42 ` Lennart Borgman
  2006-01-10  3:13   ` BRUCE INGALLS
  0 siblings, 1 reply; 119+ messages in thread
From: Lennart Borgman @ 2006-01-09 11:42 UTC (permalink / raw)
  Cc: help-gnu-emacs, Emacs Devel

LENNART BORGMAN wrote:

>>>That sure does not look right.
>>>      
>>>
>>What doesn't look right, exactly?  I took the above as a template, not
>>as a literal string that is the printer's name.  If it's a literal
>>string, then it is indeed strange, but default-printer-name simply
>>calls GetProfileString and GetPrinter APIs, so whatever those return,
>>it's the system's notion of the printer.  Unless there's a bug in
>>default-printer-name, in which case please step through it and tell
>>what goes wrong there.
>>    
>>
>
>I have felt a bit nervous over the weekend. Did I really test this with -Q? Or is it something long forgotten I have in my initialization files.
>
>I tried again with -Q. And yes, it is literally the share name I told ("1234567890").
>  
>
I also tested to print after

    (setq printer-name (default-printer-name))

The result is somewhat perplexing perhaps, but is consistent with my 
suspiciouns. I tried two physical printers. I tested two queues on the 
first and one queue on the second.

** With "Print Buffer" I got no output from the first printer on any of 
the two printer queues I tested. On the second printer I got a correctly 
printed buffer.

** With "Postscript Print Buffer" the result was the opposite. On the 
first printer the result looks like the expeced emacs postscript print 
of the buffer for both queue. On the second printer I just got the 
postscript code printed. (And this was the color printer .... - it 
surely supports postscript. The one where I can get postscript printed 
this way is only black and white.)

To me this suggest that the way Emacs get the default printer name with 
(default-printer-name) is correct enough in at least my circumstances. 
However the name "1234567890" is not the name that the queue is normally 
known by.

The result also seems to confirm that the printing modell used by Emacs 
on w32 is not correct. The GDI model for printing is the one that 
according to MS should be used on w32 in the general case. Emacs does 
not use that model now.

So my suggested workaround using htmlize-view.el still seems to be a 
good one on w32.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
  2006-01-09 11:42 ` Lennart Borgman
@ 2006-01-10  3:13   ` BRUCE INGALLS
  0 siblings, 0 replies; 119+ messages in thread
From: BRUCE INGALLS @ 2006-01-10  3:13 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/9/06, Lennart Borgman  wrote:
> >I tried again with -Q. And yes, it is literally the share name I told ("1234567890").

> The result also seems to confirm that the printing modell used by Emacs
> on w32 is not correct. The GDI model for printing is the one that
> according to MS should be used on w32 in the general case. Emacs does
> not use that model now.
>
> So my suggested workaround using htmlize-view.el still seems to be a
> good one on w32.

What happened, when you tried the command line tools I suggested?
The VB Script,
net help
net view help
net view
print /D \\host-name\1234567890 file.txt

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: Printing from WindowXP version of emacs
@ 2006-01-10 10:19 LENNART BORGMAN
  0 siblings, 0 replies; 119+ messages in thread
From: LENNART BORGMAN @ 2006-01-10 10:19 UTC (permalink / raw)
  Cc: help-gnu-emacs

From: BRUCE INGALLS <bruce.ingalls@gmail.com>

> That sure does not look right. Here's how you can test it, from the
> Windows command line:
>  net view \\host-name

Works ok. Though the name "1234567890" is in the list (a very long list BTW).


>  print /D:\\host-name\1234567890 file.txt

Does not work. I believe the reason is that the printer is not in the state required by this command (as I explained in other messages).


...
> Save the above as getPrn2.vbs, and run
>  cscript getPrn2.vbs

There are several problems with this code. All printers are not networked for example. I am using W2k, not XP however.

 
> If the output from this script does not `net view`, nor `print`, then
> some sys admin is in order, because it tested fine for me.

I do not think any sys admin is in order here - there is nothing I can do about that. The printers works ok, but not in this way.

^ permalink raw reply	[flat|nested] 119+ messages in thread

end of thread, other threads:[~2006-01-10 10:19 UTC | newest]

Thread overview: 119+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-15 15:31 Printing from WindowXP version of emacs sbrown
2005-12-15 18:30 ` Mathias Dahl
2005-12-15 18:35 ` Lennart Borgman
2005-12-16  7:50   ` Eli Zaretskii
2005-12-16  8:29     ` Lennart Borgman
2005-12-16  8:53       ` Eli Zaretskii
2005-12-16 14:53         ` Lennart Borgman
2005-12-16 15:31           ` Eli Zaretskii
2005-12-17  2:42             ` Lennart Borgman
2005-12-17  8:20               ` Eli Zaretskii
2005-12-17  9:38                 ` Peter Dyballa
2005-12-17 11:11                   ` Eli Zaretskii
2005-12-17 15:50                     ` Lennart Borgman
2005-12-17 16:31                       ` Peter Dyballa
2005-12-17 21:25                         ` Lennart Borgman
2005-12-17 23:55                           ` Peter Dyballa
2005-12-21 18:15                             ` Lennart Borgman
2005-12-21 21:51                               ` Eli Zaretskii
2005-12-21 22:50                                 ` Lennart Borgman
2005-12-21 23:41                                   ` Edward O'Connor
2005-12-21 23:51                                     ` Lennart Borgman
2005-12-17  9:51                 ` Lennart Borgman
2005-12-17 13:11                   ` Lennart Borgman
     [not found]               ` <mailman.19684.1134911288.20277.help-gnu-emacs@gnu.org>
2005-12-18 18:22                 ` Ilya Zakharevich
2005-12-18 19:23                   ` Eli Zaretskii
     [not found]                   ` <mailman.19772.1134933877.20277.help-gnu-emacs@gnu.org>
2005-12-19 17:53                     ` Ilya Zakharevich
2005-12-19 21:43                       ` Eli Zaretskii
     [not found]                       ` <mailman.19861.1135028638.20277.help-gnu-emacs@gnu.org>
2005-12-20  1:11                         ` Ilya Zakharevich
2005-12-20  4:54                           ` Eli Zaretskii
     [not found]                           ` <mailman.19893.1135054520.20277.help-gnu-emacs@gnu.org>
2005-12-20 22:40                             ` Ilya Zakharevich
2005-12-21  4:42                               ` Eli Zaretskii
     [not found]                               ` <mailman.20004.1135140203.20277.help-gnu-emacs@gnu.org>
2005-12-22 23:11                                 ` Ilya Zakharevich
2005-12-23  8:41                                   ` Eli Zaretskii
     [not found]                                   ` <mailman.20241.1135327583.20277.help-gnu-emacs@gnu.org>
2005-12-30  0:38                                     ` Ilya Zakharevich
2005-12-30 11:44                                       ` Eli Zaretskii
     [not found]                                       ` <mailman.20871.1135945105.20277.help-gnu-emacs@gnu.org>
2006-01-05  6:53                                         ` Ilya Zakharevich
2006-01-05 16:39                                           ` Eli Zaretskii
     [not found]                                           ` <mailman.21485.1136479302.20277.help-gnu-emacs@gnu.org>
2006-01-07 12:02                                             ` Ilya Zakharevich
2006-01-07 12:55                                               ` Eli Zaretskii
2005-12-20 14:45                         ` Peter Boettcher
2005-12-20 20:21                           ` Eli Zaretskii
2005-12-20 22:22                             ` Lennart Borgman
2005-12-21  4:34                               ` Eli Zaretskii
2005-12-21  7:49                                 ` Lennart Borgman
2005-12-21 18:39                                   ` Lennart Borgman
2005-12-21 19:33                                   ` Eli Zaretskii
2005-12-21 20:11                                     ` Lennart Borgman
2005-12-21 22:15                                       ` Eli Zaretskii
2005-12-21 22:48                                         ` Lennart Borgman
2005-12-22  4:38                                           ` Eli Zaretskii
2005-12-22  8:02                                             ` Lennart Borgman
2005-12-22 19:37                                               ` Eli Zaretskii
2005-12-22 20:46                                                 ` Lennart Borgman
2005-12-23  8:21                                                   ` Eli Zaretskii
2005-12-23 14:06                                                     ` Lennart Borgman
2005-12-23 15:20                                                       ` Eli Zaretskii
2005-12-24 13:49                                                         ` Eli Zaretskii
2005-12-24 14:39                                                           ` Eli Zaretskii
2005-12-24 14:58                                                             ` Eli Zaretskii
2005-12-16  9:26       ` Peter Dyballa
2005-12-16 10:45         ` Eli Zaretskii
2005-12-16  9:19     ` Peter Dyballa
2005-12-16 10:46       ` Eli Zaretskii
2005-12-16 14:19       ` Lennart Borgman
     [not found]   ` <mailman.19545.1134911104.20277.help-gnu-emacs@gnu.org>
2005-12-19  9:58     ` Mathias Dahl
2005-12-19 21:25       ` Eli Zaretskii
     [not found]       ` <mailman.19857.1135027571.20277.help-gnu-emacs@gnu.org>
2005-12-20  7:41         ` Mathias Dahl
2005-12-20 19:58           ` Eli Zaretskii
2005-12-20 20:59             ` Drew Adams
2005-12-15 19:36 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2005-12-15 19:36 Jay Bingham
2005-12-19 11:18 LENNART BORGMAN
2005-12-19 21:29 ` Eli Zaretskii
2005-12-19 22:11   ` Lennart Borgman
2005-12-19 23:05     ` Eli Zaretskii
2005-12-19 23:30       ` Lennart Borgman
2005-12-20  4:30         ` Eli Zaretskii
     [not found] <mailman.19804.1134991437.20277.help-gnu-emacs@gnu.org>
2005-12-19 16:28 ` Mathias Dahl
2005-12-20 10:58 LENNART BORGMAN
     [not found] <mailman.19907.1135077565.20277.help-gnu-emacs@gnu.org>
2005-12-20 17:15 ` Mathias Dahl
2006-01-03  0:49 BRUCE INGALLS
2006-01-03  5:10 ` Eli Zaretskii
2006-01-03  9:44 ` Peter Dyballa
     [not found] ` <mailman.21202.1136265134.20277.help-gnu-emacs@gnu.org>
2006-01-03 13:06   ` Chris McMahan
2006-01-03 19:18     ` Eli Zaretskii
2006-01-03 21:52       ` Lennart Borgman
     [not found]       ` <mailman.21297.1136325265.20277.help-gnu-emacs@gnu.org>
2006-01-03 22:08         ` David Kastrup
2006-01-03 22:12           ` Lennart Borgman
2006-01-03 13:08 LENNART BORGMAN
2006-01-03 19:20 ` Eli Zaretskii
2006-01-04  0:34 BRUCE INGALLS
2006-01-04 10:00 ` Peter Dyballa
2006-01-05  1:56   ` BRUCE INGALLS
2006-01-05 13:01     ` Peter Dyballa
2006-01-05 15:41       ` Lennart Borgman
2006-01-05 21:17         ` Peter Dyballa
2006-01-06  8:39           ` Eli Zaretskii
2006-01-05 20:44       ` Eli Zaretskii
2006-01-05 21:18         ` Peter Dyballa
2006-01-06  8:36           ` Eli Zaretskii
2006-01-06 11:59             ` Peter Dyballa
2006-01-06 14:07               ` Eli Zaretskii
2006-01-04  5:10 BRUCE INGALLS
2006-01-04  8:45 LENNART BORGMAN
2006-01-04 18:22 ` Eli Zaretskii
2006-01-04 19:14   ` Lennart Borgman
2006-01-05  1:17 ` BRUCE INGALLS
2006-01-05  9:24 LENNART BORGMAN
2006-01-05 16:43 ` Eli Zaretskii
2006-01-05 21:01   ` Lennart Borgman
2006-01-06  9:09     ` Eli Zaretskii
2006-01-07  5:00 BRUCE INGALLS
2006-01-07  9:18 ` Eli Zaretskii
2006-01-08  1:06 BRUCE INGALLS
2006-01-08  4:12 ` Eli Zaretskii
2006-01-09  8:29 LENNART BORGMAN
2006-01-09 11:42 ` Lennart Borgman
2006-01-10  3:13   ` BRUCE INGALLS
2006-01-10 10:19 LENNART BORGMAN

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.