Re: Macros for printing envelopes?

2021-07-16 Thread Peter Schaffter
Nate --

On Thu, Jul 15, 2021, Nate Bargmann wrote:
> As I see it, with groff I can easily create files for addresses I
> use often and should be able to code a script that accepts those
> one-off addresses.

I use this strategy with the mom macros.  Here's the .mom template
file:

--envelope template---

.\" #10 envelope (US)
.PAGE9.5i 4.125i .3i .3i .4i .4i
.FAM Futura
.FT  R
.PT_SIZE 11
.LS  13
.LEFT
.\" Return address here
.IL  3.5i
.SP  |2i-1v
.PT_SIZE 12.5
.LS  15
.\" Destination address here


The Return address is always filled in.  In a script, the
Destination address can either be cat(1)ted together with the
template from an address on file, or groff's .rd request can be
appended to the end of the template so one-off addresses can be
typed in at the command line.  Depending on your printer, you may
need to rotate the file to landscape orientation (the -P-l flag at
the command line).

Hope this helps.

-- 
Peter Schaffter
https://www.schaffter.ca



Re: Macros for printing envelopes?

2021-07-16 Thread James K. Lowden
On Fri, 16 Jul 2021 12:44:04 -0400
Peter Schaffter  wrote:

> On Thu, Jul 15, 2021, Nate Bargmann wrote:
> > As I see it, with groff I can easily create files for addresses I
> > use often and should be able to code a script that accepts those
> > one-off addresses.
> 
> I use this strategy with the mom macros.  Here's the .mom template
> file:

But ... don't you need some kind of input-tray selection escape, or
something?  How does the printer know to pause and wait for you to
insert an envelope?  

--jkl




Re: Macros for printing envelopes?

2021-07-16 Thread Peter Schaffter
On Fri, Jul 16, 2021, James K. Lowden wrote:
> On Fri, 16 Jul 2021 12:44:04 -0400
> Peter Schaffter  wrote:
> 
> > On Thu, Jul 15, 2021, Nate Bargmann wrote:
> > > As I see it, with groff I can easily create files for addresses I
> > > use often and should be able to code a script that accepts those
> > > one-off addresses.
> > 
> > I use this strategy with the mom macros.  Here's the .mom template
> > file:
> 
> But ... don't you need some kind of input-tray selection escape, or
> something?  How does the printer know to pause and wait for you to
> insert an envelope?  

Depends on the printer, I guess.  My one-tray printer
knows I've inserted envelopes because I insert them before
processing/sending-to-printer.  Very old school. :)

The OP was wondering about how to set up envelopes using groff
without having to write new macros.  It's easy, as my example
showed, and that's what I hoped to convey.  FWIW, it doesn't require
a macroset.  It's a walk in the park to create an envelope template
using just groff requests.

How such a template is used with a script, however, is entirely site
dependent.  As far as selecting trays goes, that can be done with
lpoptions(1) or the -o flag to lpr(1) in the script.

-- 
Peter Schaffter
https://www.schaffter.ca



Re: Macros for printing envelopes?

2021-07-16 Thread Nate Bargmann
Thanks, Peter!

My printer, a Brother HL-5240, takes input from the manual tray and like
you I insert the envelope and then print.  Typically, I feed the
envelope in with the short side at the return address in first.  To be
honest, I'm not entirely sure if that is portrait or landscape
orientation for envelopes.  On a regular letter sheet of paper the print
would be in landscape orientation, so I assume the same here.

- Nate

-- 

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819



signature.asc
Description: PGP signature


Re: Macros for printing envelopes?

2021-07-17 Thread G. Branden Robinson
Hi, Peter & James!

At 2021-07-16T18:07:10-0400, Peter Schaffter wrote:
> How such a template is used with a script, however, is entirely site
> dependent.  As far as selecting trays goes, that can be done with
> lpoptions(1) or the -o flag to lpr(1) in the script.

And options to lpr can be passed via groff's -L option, so you can say
"groff -L -o -L orientation-requested=4" or whatever.

At 2021-07-16T17:18:04-0500, Nate Bargmann wrote:
> My printer, a Brother HL-5240, takes input from the manual tray and
> like you I insert the envelope and then print.  Typically, I feed the
> envelope in with the short side at the return address in first.  To be
> honest, I'm not entirely sure if that is portrait or landscape
> orientation for envelopes.  On a regular letter sheet of paper the
> print would be in landscape orientation, so I assume the same here.

Not in groff world!  To be militantly consistent, I suppose, in groff,
standard paper formats are always at least as long as they are wide.

groff_tmac(5) discusses the "papersize" macro file.

 papersize
This macro file is normally loaded at start-up  by  the  troffrc
file,  so it is seldom necessary to call it explicitly.  It pro‐
vides an interface to set the paper size  on  the  command  line
with the option -dpaper=size to groff or troff.  Possible values
for size are the ISO and DIN formats “A0–A6”, “B0–B6”,  “C0–C6”,
and  “D0–D6”;  the  U.S.  formats  “letter”, “legal”, “tabloid”,
“ledger”, “statement”, and “executive”; and the envelope formats
“com10”,  “monarch”,  and “DL”.  All formats, even those for en‐
velopes, are in portrait orientation, with their  longer  dimen‐
sion as the length.  Appending “l” (ell) to any of these denotes
landscape orientation instead.  An output driver  typically  re‐
quires command-line switches -p and -l to override the paper di‐
mensions and orientation,  respectively,  defined  in  its  DESC
file; see subsection “Paper sizes” of groff(1).

Some of the foregoing language is pretty recent.

By the way, papersize.tmac doesn't support formats A7, B7, C7, D7, but
the output drivers do--thanks to libdriver.  Does anyone know why this
is the case?

Regards,
Branden


signature.asc
Description: PGP signature


Re: Macros for printing envelopes?

2021-07-18 Thread Nate Bargmann
* On 2021 17 Jul 18:14 -0500, G. Branden Robinson wrote:
> Not in groff world!  To be militantly consistent, I suppose, in groff,
> standard paper formats are always at least as long as they are wide.
> 
> groff_tmac(5) discusses the "papersize" macro file.
> 
>  papersize
> This macro file is normally loaded at start-up  by  the  troffrc
> file,  so it is seldom necessary to call it explicitly.  It pro‐
> vides an interface to set the paper size  on  the  command  line
> with the option -dpaper=size to groff or troff.  Possible values
> for size are the ISO and DIN formats “A0–A6”, “B0–B6”,  “C0–C6”,
> and  “D0–D6”;  the  U.S.  formats  “letter”, “legal”, “tabloid”,
> “ledger”, “statement”, and “executive”; and the envelope formats
> “com10”,  “monarch”,  and “DL”.  All formats, even those for en‐
> velopes, are in portrait orientation, with their  longer  dimen‐
> sion as the length.  Appending “l” (ell) to any of these denotes
> landscape orientation instead.  An output driver  typically  re‐
> quires command-line switches -p and -l to override the paper di‐
> mensions and orientation,  respectively,  defined  in  its  DESC
> file; see subsection “Paper sizes” of groff(1).
> 
> Some of the foregoing language is pretty recent.

Thanks, Branden.

I find my system has an interesting quirk.  Either Evince (Gnome
Document Viewer), or CUPS, or something in between defines left and
top margins of 0.25i for envelopes.  After testing with cut pieces of
scratch paper I set the lm and tm of the template to 0.05i and the
positioning is where I want it.  Changing the return address point size
a bit and choosing Helvetica as the font family as Futura is not on my
system, and I am up and going.  I now have a working template for the #6
3/4 (US) envelopes I use along with setting up a custom size in the
Gnome print dialog.

I just ran a #10 envelope and it comes out just as I'd like.  No
proprietary software required!!

Thanks to all.

- Nate

-- 

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819



signature.asc
Description: PGP signature