* basic question about printing
@ 2024-09-28 17:45 Francis
2024-10-16 14:02 ` gfp
0 siblings, 1 reply; 3+ messages in thread
From: Francis @ 2024-09-28 17:45 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Hi,
I have now 3 variables in my init.el concerning printing.
a
setq lpr-switches
b
M-x ps-print-buffer
c
printing with paps
1.
Is it right that it takes the first one, if I print in using the menu bar.?
2.
How to change the first variable in that way,
that it prints only 1 column on a A4 page?
Now it prints 2 columns.
3.
at the moment I can't use the 3 variable printing through paps.
4.
the first and second variable are printing 2 columns.
How can I change that?
thanks
Gottfried
;;printer
(setq lpr-switches
(append '("-P" "HP-Officejet-J4500-series"
"-o" "sides=two-sided-long-edge"
"-o" "number-up=2")
lpr-switches))
;;print preview
(setq ps-lpr-command "print_preview")
;;M-x ps-print-buffer or M-x ps-print-region to print to a PostScript
printer 2 pages on an A4 paper
;; 2 column landscape size 7 prints column 0-78, lines 1 to 70
;;Now you can use ‘M-x ps-print-buffer’, ‘M-x
ps-print-buffer-with-faces’, ‘M-x ps-print-region’, and ‘M-x
ps-print-region-with-faces’.
;;Use the C-u prefix to save the PostScript code into a file instead of
printing it.
(setq ps-paper-type 'a4
ps-font-size 7.0
ps-print-header nil
ps-landscape-mode t
ps-number-of-columns 2)
;; printing with paps (Jean)
(defun rcd-command-output-from-input (program input &rest args)
"Return output string from PROGRAM with given INPUT string and
optional ARGS."
(let* ((output (with-temp-buffer
(insert input)
(apply #'call-process-region nil nil program t '(t nil) nil args)
(buffer-string))))
output))
;;I am too often using landscape, you can adjust it for your needs.
(defun rcd-paps-process (text &optional format title &rest args)
(let* ((format (or format "pdf"))
(title (or title (buffer-name)))
(length (length title))
(max 45)
(title (if (> length max) (substring title 0 max) title)))
(apply 'rcd-command-output-from-input "paps" text "--format" format
"--landscape" "--title" title "--header" args)))
(defun string-to-file-force (string file)
"Prints string into file, matters not if file exists. Return FILE as
file name."
(with-temp-file file
(insert string))
file)
^ permalink raw reply [flat|nested] 3+ messages in thread
* basic question about printing
2024-09-28 17:45 basic question about printing Francis
@ 2024-10-16 14:02 ` gfp
2024-10-19 5:44 ` Michael Heerdegen
0 siblings, 1 reply; 3+ messages in thread
From: gfp @ 2024-10-16 14:02 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org, Jean Louis
[-- Attachment #1.1.1: Type: text/plain, Size: 2886 bytes --]
Sorry, I sent this email with my old email address,
may be therefore I didn't get an answer.
I was looking on the web for hours, but I didn't find help.
So I am writing to you.
Betreff: basic question about printing
Datum: Sat, 28 Sep 2024 19:45:05 +0200
Von: Francis <francis.pr@gmail.com>
An: help-gnu-emacs@gnu.org <help-gnu-emacs@gnu.org>
Hi,
I have now 3 variables in my init.el concerning printing.
a
setq lpr-switches
b
M-x ps-print-buffer
c
printing with paps
1.
Is it right that it takes the first one, if I print in using the menu
bar and it disregards the others?
2.
How to change the variables in that way,
that it prints with more space on the left and right side?
and with smaller letters, because now they are too big?
3.
at the moment I can't print through paps.
What do I have to do that I can try to print with paps?
4.
because I am a newcomer in Emacs, what can I do,
so that if using the printing button on the menu bar gives me more options.
thanks for help
Gottfried
here my init.el file:
;;printer
(setq lpr-switches
(append '("-P" "HP-Officejet-J4500-series"
"-o" "sides=one-sided-long-edge"
"-o" "number-up=1")
lpr-switches))
;;print preview
(setq ps-lpr-command "print_preview")
;;M-x ps-print-buffer or M-x ps-print-region to print to a PostScript
printer 2 pages on an A4 paper
;; 2 column landscape size 7 prints column 0-78, lines 1 to 70
;;Now you can use ‘M-x ps-print-buffer’, ‘M-x
ps-print-buffer-with-faces’, ‘M-x ps-print-region’, and ‘M-x
ps-print-region-with-faces’.
;;Use the C-u prefix to save the PostScript code into a file instead of
printing it.
(setq ps-paper-type 'a4
ps-font-size 7.0
ps-print-header nil
ps-landscape-mode t
ps-number-of-columns 2)
;; printing with paps (recommended by Jean)
(defun rcd-command-output-from-input (program input &rest args)
"Return output string from PROGRAM with given INPUT string and
optional ARGS."
(let* ((output (with-temp-buffer
(insert input)
(apply #'call-process-region nil nil program t '(t nil) nil args)
(buffer-string))))
output))
;;I am too often using landscape, you can adjust it for your needs.
(defun rcd-paps-process (text &optional format title &rest args)
(let* ((format (or format "pdf"))
(title (or title (buffer-name)))
(length (length title))
(max 45)
(title (if (> length max) (substring title 0 max) title)))
(apply 'rcd-command-output-from-input "paps" text "--format" format
"--landscape" "--title" title "--header" args)))
(defun string-to-file-force (string file)
"Prints string into file, matters not if file exists. Return FILE as
file name."
(with-temp-file file
(insert string))
file)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2451 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: basic question about printing
2024-10-16 14:02 ` gfp
@ 2024-10-19 5:44 ` Michael Heerdegen
0 siblings, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2024-10-19 5:44 UTC (permalink / raw)
To: gfp; +Cc: help-gnu-emacs@gnu.org, Jean Louis
gfp <gfp@posteo.at> writes:
> Sorry, I sent this email with my old email address,
> may be therefore I didn't get an answer.
I found your question a bit hard to read. You email address was not
such much a problem.
> I have now 3 variables in my init.el concerning printing.
>
> a
> setq lpr-switches
>
> b
> M-x ps-print-buffer
>
> c
> printing with paps
>
> 1.
> Is it right that it takes the first one, if I print in using the menu
> bar and it disregards the others?
This one is hard to understand. More or less "yes" I guess. But you
can also ps-print using the menu. Never used paps.
> 2.
> How to change the variables in that way,
> that it prints with more space on the left and right side?
With ps-printing `ps-left-margin' and `ps-right-margin' and
> and with smaller letters, because now they are too big?
`ps-font-size'? Have a look at the user options defined in
"ps-print.el".
> 4. because I am a newcomer in Emacs, what can I do, so that if using
> the printing button on the menu bar gives me more options.
There exists a package "printing.el" for this purpose which is nowadays
included in Emacs. I don't use it, but I know it provides a convenient
interface that can be used from the menu.
Note that a very convenient thing for newcomers is "htmlize.el": This
lets you convert buffer contents to a html representation that looks
nice most of the time and print that using a browser printing dialog or
whatever. This has the advantage that you can start with zero
configuration.
ps printing also works conveniently but may require a bit more setup in
Emacs. You are on the way here. Personally, as a start, I would then
just print the ps file using a ps viewer instead of printing directly
from Emacs. Printing dialogs have lots of useful features built-in.
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-19 5:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-28 17:45 basic question about printing Francis
2024-10-16 14:02 ` gfp
2024-10-19 5:44 ` Michael Heerdegen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).