Subject: Re: bug#3332: bug#4275: 23.1; Printing

From: Eli Zaretskii <[email-masked]>
Date: Mon, 31 Jan 2022 21:19:50 +0200

> From: Arash Esbati <[email-masked]>
> Date: Mon, 31 Jan 2022 19:56:09 +0100
> Cc: Francis Wright <[email-masked]>, [email-masked],
>  [email-masked]
> 
> Lars Ingebrigtsen <[email-masked]> writes:
> 
> > "Francis Wright" <[email-masked]> writes:
> >
> >> direct-print-region-helper: Opening output file: permission denied,
> >> c:/DOT4_001
> >>
> >> My printer is an hp LaserJet 1010 connected via USB and the printer
> >> driver properties show that it is connect to the port DOT4_001. I
> >> think the problem is that "c:/" has been prepended to the port name.
> >>
> >> I see that the same thing happens in Emacs 22.3. (I don't print from
> >> Emacs very often!)
> >
> > (I'm going through old bug reports that unfortunately weren't resolved
> > at the time.)
> >
> > Do you still see this problem in recent versions of Emacs/Windows?
> 
> I see this problem: I did 'M-x view-hello-file RET' and from the menu
> bar, I did 'File->Print->Print buffer', said YES when asked to use the
> default printer, and this is the backtrace:
> 
> --8<---------------cut here---------------start------------->8---
> Debugger entered--Lisp error: (permission-denied "Opening output file" "Permission denied" "c:/WSD-5bc23311-7bc5-46f6-a594-1552b4df353d")
>   w32-direct-print-region-helper("WSD-5bc23311-7bc5-46f6-a594-1552b4df353d" 1 #<marker at 5393 in  *spool temp*> "" nil #<buffer  *temp*> nil ("(page headers are not supported)"))
>   w32-direct-print-region-function(1 #<marker at 5393 in  *spool temp*> "" nil #<buffer  *temp*> nil "(page headers are not supported)")
>   apply(w32-direct-print-region-function 1 #<marker at 5393 in  *spool temp*> "" nil #<buffer  *temp*> nil "(page headers are not supported)")
>   lpr-print-region(1 #<marker at 5393 in  *spool temp*> ("(page headers are not supported)") "HELLO Emacs buffer")
> --8<---------------cut here---------------end--------------->8---
> 
> I have a HP Laserjet on network connected via WSD Port (hence the name
> WSD-5bc...).  This is Emacs 29.0.50 (3ca32105d2) on Win10.

See the node "Windows Printing" in the Emacs manual, which explains
that the default setting of the printer on MS-Windows isn't guaranteed
to work, and provides a few alternative suggestions for setting up the
printer.

I don't think we can do anything with these problems beyond describing
the various tricks of the trade.