DaemonForums  

Go Back   DaemonForums > Miscellaneous > General software and network

General software and network General OS-independent software and network questions, X11, MTA, routing, etc.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 6th January 2015
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,517
Default [Solved]Envelope Printing in Unix

As part of a New Years resolution to get organized I set up label printing in LIbreoffice.
Additional inspiration came from Jggimi's post to set up a queue for envelope printing. This is where things got complicated.

My aged but faithful HP 5L Laserjet is not a postscript printer so I ended up with the following
Code:
 cat /etc/printcap 
#	$OpenBSD: printcap,v 1.4 2003/03/28 21:32:30 jmc Exp $

# Default Network printer US letter
lp|ljet4:\
    :lp=9100@192.168.1.2:\
    :if=/usr/local/libexec/foomatic.filter.default:\
    :sd=/var/spool/output:\
    :lf=/var/log/lpd-errs:\
    :sh:
#
# Same Network printer for Manual Feed #10 envelopes
# Envelope dimensions 10.4cm x 24.1cm
5l_env|ljet4:\
    :lp=9100@192.168.1.2:\
    :if=/usr/local/libexec/foomatic.filter.env10:\
    :sd=/var/spool/output-env10:\
    :lf=/var/log/lpd-errs"\
    :sh:
and the following filters
Code:
cat /usr/local/libexec/foomatic.filter.default
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
        /usr/local/bin/foomatic-rip --ppd \
	/etc/foomatic/direct/HP-LaserJet-5L.ppd \
        -o PageSize=letter -o Resolution=300x300dpi \
        -o OutputType=Grayscale
and
Code:
cat /usr/local/libexec/foomatic.filter.env10                                            <
#!/bin/sh

/usr/local/bin/a2ps -Brq --columns=1 -o - | \
        /usr/local/bin/foomatic-rip --ppd \
	/etc/foomatic/direct/HP-LaserJet-5L.ppd \
        -o InputSlot=Manual -o PageSize=COM10 \
        -o Resolution=300x300dpi -o OutputType=Greyscale
Initially trying to Insert -> envelope in lowriter my default page size had changed to a4.
This appeared to be due to /etc/papersize having a default value of a4 which libreoffice still reads. I corrected it to letter for my U.S. locale. papersize(5) does not have envelope sizes.

This issue now is that the envelope dimensions in libreoffice for #10 envelopes are incorrect. This appears to be a bug in LibreOffice.

I found this guide to generating and printing envelopes

My confusion is the printcap entry env10. It looks like I can set the envelope dimensions with the a2ps -M with landscape orientation or with "-o" to the ppd output. "Env10" is a LetterSize in the ppd but I'm not sure if it automatically sets landscape orientation.

Any recommendations regarding printing simple 4.13inch x 9.5inch envelopes?

Last edited by shep; 22nd January 2015 at 06:07 PM. Reason: 1) Updated working filters 2) Corrected env10 filter for landscape
Reply With Quote
  #2   (View Single Post)  
Old 6th January 2015
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,517
Default

It seemed to work best if I specified #10 envelopes in the ppd output rather than as a2ps output. The filter below uses the default a2ps output which on my system is set in /etc/papersize letter

Code:
PooBear$ cat /usr/local/libexec/foomatic.filter.env10  
#!/bin/sh

/usr/local/bin/a2ps -Brq --columns=1 --borders=no  -o - | \
        /usr/local/bin/foomatic-rip --ppd \
	/etc/foomatic/direct/HP-LaserJet-5L.ppd \
	  -o InputSlot=Manual -o PageSize=COM10
Reply With Quote
  #3   (View Single Post)  
Old 6th January 2015
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

You are completely off the mark here. Libreoffice just like Microsoft office is the wrong tool for such things. I am not sure it they are right tools for anything anyway.


Two good options. The first option is label nation http://www.red-bean.com/labelnation/ Python script which uses pure PostScript as its backend to batch create the labels. PostScript is the kind a right language for the job since is page description language but it suffers from a lack of fonts. Namely changing fonts is non-trivial. However combination of Python and PostScript is very potent as programming in pure PostScript is slow to say at least (some of us have done it of course).
Second option is to use TeX or some kind package for LaTeX macros. I have to say as somebody who has been using TeX for the past 25 years that this is one of the gray areas where TeX appears to be the right tool but I have never found decent enough package to do labels the way I wanted. From the top of my head TeX is wrong tool for writing man pages (use mandoc) and typing music (use Lilypond). Please go search for my posts on TeX/LaTeX stack exchange for more info on these topics.
Reply With Quote
  #4   (View Single Post)  
Old 6th January 2015
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,517
Default

Quote:
You are completely off the mark here. Libreoffice just like Microsoft office is the wrong tool for such things. I am not sure it they are right tools for anything anyway.
The issue I was having in Libreoffice was that envelope printing did not correctly set sheet size and margins on my HP 5L laserjet. On a neighbours Brother 2270DW it works fine

For me Libreoffice was very functional in producing mailing labels on a sheet. It also offers an option to utilize a dedicated label printer that produces individual labels from a spool. I do not have a dedicated label printer so I can only comment that the option exists

Pulling address entries directly from a database/spreadsheet also works; generating an intermediate text file is not needed. If the database is registered by Libreoffice, additions/edits to the original data source become available data fields the next time the labels are generated. Lastly, Libreoffice offers the ability to import database fields into the body of the letter using mailmerge

In the initial post I was mainly looking for guidance as to setting envelope size and printing orientation in a non-postscript printer without cups. Should it be set via the a2ps -o flag or the ppd -o flag or both? I can report that it works with just the ppd -o flags.
Reply With Quote
  #5   (View Single Post)  
Old 6th January 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,027
Default

I don't use print/a2ps as I go straight from an application to Postscript output or to PDF. However, since you mention Libreoffice I recall I've had trouble with Libreoffice printing envelopes the way I wanted.

I've found LyX (print/lyx) easier to use, and deal with, for general document editing as well as envelope printing. Oko will be pleased, it's TeX-based. But its a graphical editor so I don't ever have to remember any TeX or LaTeX markup language. I'm too old.

I have never needed to do mail merging to print multiple envelopes, but if I did I'd still use LyX, as there are mail merge macros/scripts around, or I could cobble something up to script a merged plain text/markup document file. For all I know, there's a button to press, I've never looked.

Last edited by jggimi; 6th January 2015 at 06:07 PM. Reason: typos, formatting, links
Reply With Quote
  #6   (View Single Post)  
Old 7th January 2015
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,517
Default

I was able to get libreoffice to generate a nice landscape #10 envelope which I exported to a *pdf.
Libreoffice -> lowriter -> File -> Text Document -> Format -> Page.
Choose landscape and #10 envelope. You can also adjust margins

I then added my text fields along with a small lineart image and exported to pdf.

To print open the pdf in textproc/xpdf and print to the envelope printcap entry.

I have about 3 monthly mailings although I would like to learn print/Lyx this is good for now.
Reply With Quote
Reply

Tags
print envelope, print labels


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LPD printing Oko Guides 28 10th May 2020 12:01 AM
lpd printing in Current shep OpenBSD Installation and Upgrading 4 20th December 2012 07:30 PM
unwanted printing - cracking? lumiwa FreeBSD Security 9 10th July 2012 01:28 PM
Printing. The final frontier. girarde OpenBSD General 11 5th January 2011 01:03 PM
Problem with printing unicyclist OpenBSD General 8 1st May 2009 07:06 PM


All times are GMT. The time now is 11:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick