cvs commit: hints printing_minority_report.txt

timothy at linuxfromscratch.org timothy at linuxfromscratch.org
Sun May 25 06:14:54 PDT 2003


timothy     03/05/25 09:14:54

  Modified:    .        printing_minority_report.txt
  Log:
  Trimmed aliases, converted hint style, added a2ps as a concession to deal with multipage ascii files.
  
  Revision  Changes    Path
  1.4       +309 -127  hints/printing_minority_report.txt
  
  Index: printing_minority_report.txt
  ===================================================================
  RCS file: /home/cvsroot/hints/printing_minority_report.txt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- printing_minority_report.txt	16 May 2003 15:21:57 -0000	1.3
  +++ printing_minority_report.txt	25 May 2003 13:14:54 -0000	1.4
  @@ -4,46 +4,71 @@
   
   AUTHOR:		"Declan Moriarty"<declan.moriarty at ntlworld.ie>
   
  -SYNOPSIS:	Quick Easy Printing without all those (expletives deleted) 
  -		print programs
  +SYNOPSIS:	Get Printing in 60 minutes.
   
   HINT:
   
   For those without Postscript printers who get pissed off big time with
   printing programs in linux and only need basic functionality, one
   dissented loser with all this printing crap took the following way out. 
  -Printing is accomplished by ghostscript, and a simple but effective script
  -kindly contributed by Uli Fahrenberg <uli at math.auc.dk>. All the other 
  -preprocessor programs, and post processors that make printing such a drag
  -in linux can be junked. They are ALL redundant bloat!
  +Printing is accomplished by ghostscript, and a simple but effective 
  +script kindly contributed by Uli Fahrenberg <uli at math.auc.dk>. This hint
  +does not install 10 packages and then tell you 'it all worked for me'.
  +I install a max of 3 and tell you how to hack them to your taste.
   
  -CHANGES: 16TH May 2003: Added 'lpr' script by Uli Fahrenberg to replace
  +
  +CHANGES: 
  +
  +	22nd May 2003: Trimmed aliases, halved self congratulatory
  +	propeganda and bloat, converted to a more noraml hint style
  +	form it's highly eccentric predecessor.Added a2ps as a
  +	concession to deal with multipage ascii files.
  +
  +	16TH May 2003: Added 'lpr' script by Uli Fahrenberg to replace
   	ALL print programs. Caught some of my own spelling & grammar 
   	mistakes. Reworked opening boasts accordingly.
   
  +SOFTWARE:
  +
  +GHOSTSCRIPT: 
  +ftp://ftp.easysw.com/pub/ghostscript/espgs-7.05.6-source.tar.bz2
  +
  +ABIWORD:(or any other word processor entirely at your own discretion)
  +http://www.abisource.org and download from nearest mirror.
  +There are also Maxwell, OpenOffice, and many others. Choose yours.
  +
  +(Optionally) a2ps (For multipage ascii documents only)
  +http://www.infres.enst.fr/~demaille/a2ps/4.13.html (Current 20/05/2003)
   
  -Get a Word Processor - Abiword is mine. A hint is there, and it
  +
  +INSTALLING:
  +
  +1. Get a Word Processor - Abiword is mine. A hint is there, and it 
   worked for me. If it doesn't work for you, argue with him, not me. 
   
  -If  you haven't done anything right yet, build abiword first. It has loads
  -of nice fonts which you can include in ghostscript by adding
  +If  you haven't done anything right yet, build abiword first. It has
  +loads of nice fonts which you can include in ghostscript by adding
   '--with-fontpath=/usr/local/share/AbiSuite/fonts' to the gs
  -'./configure'.  Otherwise see 8 below.
  +'./configure'.  Otherwise see below.
   
  -Get ghostscript. I used espgs-7.05. Get a display of that tiger up on screen, 
  -as per Ghostscript hints, printing hints, etc, etc, using these commands
   
  -cd <ghostscript source dir>
  -gs examples/tiger.ps
  +2. Get ghostscript. I used espgs-7.05. There's all sorts of patches if
  +you want to go with gnu ghostscript, and AFAIK, Version 8 doesn't
  +compile for those who have tried it.
   
   I won't bore you further on this. There is a ghostscript hint.From my 
   inspection the gimp printer drivers for ghostscript seem to offer more 
  -promise than the cups ones. So a good set of options for ghostscript might
  -include the following
  +promise than the cups ones. So a good set of options for ghostscript 
  +might include the following
   ./configure --with-drivers=all --with-cups --with-gimp --with-fontpath=<etc>
   
  +If you don't have cups or gimp - that's fine. Lie through your teeth ;-)
  +
  +This completes necessary installing. Easy, wasn't it?
   
  -2.  Type gs -h at a prompt and select your printer from the pageful of
  +CONFIGURING:
  +
  +3. Type gs -h at a prompt and select your printer from the pageful of
   drivers that it gives up. I have a BJC-4000 (bjc600 driver), but like a
   true cheapskate, I use b/w cartridges, so bjcmono suits me. The bjc600
   driver performs poorly, giving colour to a b/w printer. You may then
  @@ -66,9 +91,9 @@
   cat /tmp/testit > /dev/lp0
   
   or whatever point in the /dev directory your printer resides in. Paper
  -& ink should flow relatively productively.Repeat until it does. If you
  -get a ghostscript crash, look for a wordlike 'invalidfileaccess' (file error)
  -as a hint to what went wrong. If you can see the file but not send it to
  +& ink should flow relatively productively. If you get a ghostscript
  +crash, look for a wordlike 'invalidfileaccess' (file error) as a hint
  +to what went wrong. If you can see the file but not send it to
   print,have you permission? If so,  it's your '-sDEVICE=' option or a
   syntax error.
   
  @@ -78,24 +103,13 @@
   
   and kick yourself for being too security conscious.
   
  -3 I have  following alias  in /etc/profile or some config file like
  -that which bash reads. I suggest you get them working from a command 
  -line anyhow. With Uli's script (Section 10) these are basically 
  -redundant.
  -
  -alias lps='gs -q -dBATCH -dNOPAUSE -dSAFER -sDEVICE=bjcmono -r360   \
  -- sOutputFile=/var/spool/canon'
  -
  -It is for postscript and pdf files.  The usage is  'lps <filename.ps or
  -filename.pdf> . It hangs you there for a few seconds, and when it
  -returns,  /var/spool/canon has the file in canon printer language.
  -
  -Less /var/spool/canon
  -
  -should show you a binary file full of gibberish. Perfect!
  -The details after    ' -sOutputFile=' can be any filename.
  - -sOutputFile=/home/your_dir/rude_word would work just as well. Those
  -options mean:
  +To save paper - less /tmp/testit
  +
  +should show you a binary file full of gibberish. Perfect!  If you see
  +text, you've got problems. The details after ' -sOutputFile=' can be
  +any filename.  -sOutputFile=/home/your_dir/rude_word would work just as
  +well. Those options mean: 
  +
   -q - tells gs not to display anything & saves it looking for X.
   
   -dBATCH - tells gs to quit after processing - always a good idea.
  @@ -112,50 +126,35 @@
   
   -sOutputFile= write to this output file (congratulations for guessing!)
   Brew your own cocktail of these options. Refine & remember it, or write
  -it down.
  -
  -4. I found I needed a few lines on top of the page with cat as my
  -printing tool.  I got them the lazy way vim  /tmp/header. It says "new
  -file"; hit insert, return 3 times, escape,  and :wq. You should have a
  -/tmp/header file with three blank lines ;-)
  -
  -5. Another alias  in etc/profile to get it out to the printer
  -
  -alias print='cat /tmp/header /var/spool/canon >/dev/lp0'
  -
  -This sends my file /var/spool/canon to the printer after /tmp/header.
  -Alter the space with more or less return characters in the  header
  -file. The filename (I show /var/spool/canon) has to be the same in both
  -aliases.  Log out and in again, to get the profile read. Type
  -
  -alias
  -
  -at a prompt to check they are being read.
  -
  -6. Usage is as follows: 
  -
  -	1. To use the aliases, print to file from any application, e.g.
  -save a file as /tmp/testprint.ps from your wp. Then
  -
  -lps /tmp/testprint.ps && print
  +it down. 'Man gs' is instructive.
   
  -will write a file of raw data ready for your printer, and send it out to 
  -the printer.
  +-sPAPERSIZE= (if I have to tell you this....).
   
  -	2. To send a text only file, you can either convert it to ps (open 
  -it in a word processor and print to file) or 
  -
  -cp <textfile> /var/spool/canon && print
  +An added refinement is to review the gs -h info. At the end it
  +mentions a number of places where ghostscript checks for fonts.
  +Let one of them symlink to wherever abiword hid it's selection
  +(/usr/local/share/AbiSuite/fonts on my system), so ghostscript can
  +tap in, in the vain hope that you might get a WYSIWYG word processor.
  +It might even work.
   
  -or cat /tmp/header <textfile> >/dev/lp0
   
  +3. Skip this if you are opting for the a2ps option for multipage ascii. 
  +You should also be able to print text with 'cat > /dev/lp0' or
  +wherever your printer is. I found I needed a few lines on top of the
  +page with cat as my printing tool.  I got them the lazy way vim
  +/tmp/header. It says "new file"; hit insert, return 3 times, escape,
  +and :wq. You should have a /tmp/header file with three blank lines ;-)
  +
  +An alias  in etc/profile to get it out to the printer
  +
  +alias print='cat  /tmp/header  /tmp/testit  >  /dev/lp0'
  +
  +This sends my file /tmp/testit to the printer after /tmp/header.
  +Log out & in to get the alias recognised. Type alias and see if print
  +is actually one of the ones listed
   
  +Usage: print <filename>or cat /tmp/header <textfile> >/dev/lp0
   
  -either of which will send  your filename to the printer after your blank 
  -header file. This can be reduced to a single command by someone with the 
  -least bit of scripting acumen, but I haven't got that. Fortunately,  Uli 
  -Fahrenberg <uli at math.auc.dk> has, and I have appended the script that he 
  -provided for this as section 10. It works!
   
   A hidden gotcha is that multipage ascii docs will mess up by
   missing headers and often a few lines between pages. Load them in
  @@ -164,10 +163,10 @@
   Uli's script (section 10) ideally needs a text section to send a 
   header at the top of each page of ascii. If you can dream it up,  
   script it and send it to me for inclusion. You, of course, will get 
  -credited.
  +credited, and a2ps will come out.
   
   
  -7. Some tidying up :-D.  Use 'make uninstall' targets on your
  +4. Some tidying up :-D.  Use 'make uninstall' targets on your
   "printing" programs if they exist. Then, if cups
   has you seriously browned off (like it has me), for example
   
  @@ -178,13 +177,13 @@
   	rm  -rf /usr/share/docs/cups
   
   All those unnecessary files in the /usr/bin & /usr/local/bin
  -directories (broken loser program to do what I'm doing with two
  -aliases): gsbj; gsdj gsdj500; gslp; lp; lpr; lpd; lpadmin; lpstat, and
  -probably lp*. You get the  idea.  Have fun, and don't come crying to me
  -if you mess up by overdoing it. You can always reinstall, and
  -reconfigure. It's your system. You're the boss. I suggest you choose a
  -directory for print files - NOT
  -/home/you/followed/by/a/long/directory/name but /tmp. You can then add a
  +directories; broken loser program to do what we are doing: gsbj; gsdj;
  +gsdj500; gslp; lp; lpr; lpd; lpadmin; lpstat, and probably lp*. You get
  +the  idea.  Have fun, and don't come crying to me if you mess up by
  +overdoing it. You can always reinstall, and reconfigure. It's your
  +system. You're the boss. I suggest you choose a directory for print
  +files - NOT /home/you/followed/by/a/long/directory/name but /tmp. You
  +can then add a
   
   rm -f /tmp/*.ps
   
  @@ -194,52 +193,44 @@
   
   rm -i /tmp/*.ps and play God with these files.
   
  -Note that we got to here without cups, a2ps, gimp, and a huge amount of the
  -formatters and translators that seem to gather around inferior print 
  -strategies. Sad to say, few of these have 'make uninstall' targets, but such 
  -could be manufactured by attacking the Makefile :-D. It would be wise 
  -here to make sure you don't chop anything you actually want. Later LFS versions
  -have a package manager, so this shouldn't be an issue.
  +Note that we got to here without a huge amount of the formatters and 
  +translators that seem to gather around inferior print strategies. Sad 
  +to say, few of these have 'make uninstall' targets, but such could be 
  +manufactured by attacking the Makefile :-D. 
  +
  +
  +5. If your docs have appearance problems, be aware that there are a
  +useful set of help documents in the .abw format which come with the
  +abiword source tree which AFAIK are not installed anywhere. These are
  +in the ~/abi/docs/ subdirectory.  They give details of how to load
  +windoze fonts, as well as the the best and most logical explanation of
  +the tortured intricasies of the Unix font and locale systems that I
  +have come across in some time. The abiword source is worth downloading
  +for these alone, even if you hate the thing. Unfortunately, in real M$
  +style, they are in abiword's individual .abw format. 
   
  -8. An added refinement is to review the gs -h info. At the end it
  -mentions a number of places where ghostscript checks for fonts.
  -Let one of them symlink to wherever abiword hid it's selection
  -(/usr/local/share/AbiSuite/fonts on my system), so ghostscript can
  -tap in, in the vain hope that you might get a WYSIWYG word processor.
  -It might even work.
  -
  -9. If you are still having problems, be aware that there are a useful set of
  -help documents in the .abw format which come with the abiword source tree which
  -AFAIK are not installed anywhere. These are in the ~/abi/docs/ subdirectory.
  -They give details of how to load windoze fonts, as well as the the best and
  -most logical explanation of the tortured intricasies of the Unix font and
  -locale systems that I have come across in some time. The abiword source is 
  -worth downloading for these alone, even if you hate the thing. Unfortunately,
  -in real M$ style, they are in abiword's individual .abw format. 
  -
  -10. The first versions of this hint contained an appeal to savants for a 
  +6. The first versions of this hint contained an appeal to savants for a 
   printing script to automate this.
   
  -This script below (name it lpr locally) takes a .ps or .pdf file and 
  -spits it at the printer, something printer programs seem to find difficulty
  -with ;-). Uli Fahrenberg <uli at math.auc.dk> contributed this, and we bow 
  -and scrape in his general direction :-).
  -
  -Before you say it doesn't work, revisit point 7 and make sure you cleared all 
  -the other lpr programs out of the path. Install it somewhewre in the path and 
  -chmod it to 755. 
  +This script below (name it lpr locally) takes a .ps or .pdf file and
  +spits it at the printer, something printer programs seem to find
  +difficulty with ;-). Uli Fahrenberg <uli at math.auc.dk> contributed this,
  +and we bow and scrape in his general direction :-).
  +
  +Before you say it doesn't work, revisit point 4 and make sure you
  +cleared all the other lpr programs out of the path. Install it
  +somewhewre in the path and chmod it to 755. 
   
  -Next, open lpr in your favourite editor. You may need to hack as follows.
  +Next, open lpr in your favourite editor. You may need to hack it.
   
   	1. Line 6 - DEVICE=<your printer driver>. Set now as ljet4
   	2. Line 7 - LP=<your printer port> without the '/dev/' bit
   	3. Lines 33, 43. If your paper isn't a4, edit it's size here
   
  -Usage is simple: it IS lpr, and does everything a 500K binary should: Print from
  -the 'print' function in any program, or call it from  a command line or script.
  -
  -At a stroke we have obsoleted megabytes of bloated crap associated with 
  -printing. More Power to you, Uli!
  +Usage is simple: it IS lpr, and does everything a 500K binary should:
  +Print from the 'print' function in any program, or call it from  a
  +command line or script. At a stroke we have obsoleted megabytes of 
  +bloated crap associated with printing. More Power to you, Uli!
   
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   #!/bin/bash
  @@ -288,11 +279,202 @@
           rm /tmp/.lp-lock)&
   fi
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  +And to you, the reader: You should now be printing! 
  +If you want printing by users,  chmod 666 /dev/lp0
  +Also revisit the permissions of lpr (755), and gs (751)
  +
  +7. Programmers and others like hint maintainers may have a need for
  +multipage ascii documents. As a concession to their needs, we cover
  +installing another program, a2ps. This is against the minimalist,
  +'delete all the crap' philosophy of this hint, but I weakened.
  +
  +Install is the usual ./configure && make && make install. If you don't
  +like the /usr/local/etc location give it a --sysconfdir instruction on
  +the configure. 
  +
  +A2ps has as many options as pppd :-(. If that wasn't bad enough, most
  +of them have long and short versions. He takes it for granted we all
  +know C :-/.Hack the config file and you can forget them. Here is how.
  +
  +cp /usr/local/etc/a2ps.cfg /usr/local/etc/a2ps.cfg.orig just in case.
  +
  +Install something like this as  /usr/local/etc/a2ps.cfg. I shortened
  +the original considerably but left it's sections intact, so you could
  +find things in it.
  +
  +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  +# -*- ksh -*-
  +# a2psrc
  +
  +#################################################################
  +# 1)            Definition of some media                        #
  +# (Must be defined before --medium)                             #
  +#################################################################
  +# Medium: name, width height [llx lly urx ury]
  +Medium: A3       842    1190
  +Medium: A4       595     800
  +Medium: A5       420     595
  +Medium: B4       729    1032
  +Medium: B5       516     729
  +Medium: Letter   612     792
  +Medium: Legal    612    1008
  +Medium: Tabloid  792    1224
  +Medium: Ledger  1224     792
  +Medium: Statement 396    612
  +Medium: Executive 540     720
  +Medium: Folio    612     936
  +Medium: Quarto   610     780
  +Medium: 10x14    720    1008
  +
  +# Desk Jet users: bigger margins
  +#	Also bigger ink cartridge bills :-D 
  +
  +#################################################################
  +# 2)    Path to the a2ps resource                               #
  +#################################################################
  +# Default path where a2ps dropped its library files.
  +LibraryPath: /usr/local/share/a2ps/sheets:/usr/local/share/a2ps/ps:/usr/
  +local/share/a2ps/encoding:/usr/local/share/a2ps/afm:/usr/local/share/a2p
  +s/ppd:/usr/local/share/a2ps/fonts:/usr/local/share/a2ps
  +
  +
  +#################################################################
  +# 3)    System dependant parameters                             #
  +#################################################################
  +# By default, produce Level 1 PostScript.
  +# Currently it only means to consider only the 13 level 1 standard
  +# fonts, and not the 35 standard level 2 fonts.
  +DefaultPPD: level2
  +
  +# First, the default printer (option -d, no argument)
  +DefaultPrinter: | lpr
  +
  +
  +# Second, a printer unkown to a2ps (option -P, argument is #o)
  +UnknownPrinter: | lpr
  +
  +# Then, special printers you might want to define.
  +# Here, dominique is a Level 2 PostScript printer
  +# Printer: dominique level2 | lp -d dominique
  +
  +# Default encoding
  +Options: --encoding=latin1
  +
  +# Default medium
  +Options: --medium=A4
  +
  +Options: --lines-per-page=60
  +
  +
  +# How to call file(1), and if possible, follow the links
  +FileCommand: /usr/bin/file -L
  +
  +
  +#################################################################
  +# 4)    Your printers                                           #
  +#################################################################
  +
  +#################################################################
  +# 5)    Default settings                                        #
  +#################################################################
  +# Two virtual pages per sheet.
  +Options: -1
  +
  +# Set automatic pretty-printing on (set to "plain" for off)
  +Options: --pretty-print
  +
  +# By default, single sided printing
  +Options: -s1
  +
  +# Name of the document is the list of files
  +# (Don't put too many of them: it breaks some PS interpreters)
  +# ptions: '--title=#10!f|$n|, |'
  +
  +# Header is the client of the job
  +# Options: --header=%a
  +
  +# Title of the page is the (short) name of the current file
  +# or the first taged text if there is
  +Options: --center-title=#?1|$t1|$n|
  +
  +# Left part of the title is the mod. date of the file
  +# or empty is there is a tag2
  +Options: '--left-title=#?2||$e $T|'
  +
  +# Right part of the title is the page number
  +# or tag2 if there is
  +Options: '--right-title=#?2|$t2|$Q|'
  +
  +# If in landscape, print date on the left hand side
  +# If portrait, then print date on recto, and sheet # on verso
  +Options: --left-footer=#?l!%E!#?v|%E|%s./%s#|!
  +
  +# Center footer is the list of files on this sheet if landscape
  +# Options: '--footer=#?l|#!s-$f-, -||'
  +
  +# If in landscape, print date on the right hand side
  +# If portrait, then print date on verso, and sheet # on recto
  +# Options: --right-footer=#?l!%s./%s#!#?v|%s./%s#|%E|!
  +
  +# We want the %%Page comments to be instructive.
  +# There are two predefined choices: #{pl.short} and #{pl.long}
  +PageLabelFormat: #{pl.short}
  +
  +
  +#################################################################
  +# 6)    Preconfigured Macro Meta Sequences                      #
  +#################################################################
  +#
  +# Some Macros for the delegations
  +#       Strictly for the ambitious!
  +
  +#################################################################
  +# 7)    Preconfigured delegations                               #
  +#################################################################
  +#
  +# Delegations are ways to hand off the processing of some
  +# files to other filters.
  +#        What other filters? 
  +
  +#################################################################
  +# 8)    Some interesting UserOptions/Printers                   #
  +#################################################################
  +
  +#               Yeah... Right!
  +
  +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  +
  +Trim out my nauseous disrespectful comments, and insert your own more 
  +pointed and caustic humour.Interesting things to note are: (Section 
  +numbers in Brackets)
  +
  +(1)Medium: A4       595     800. 
  +
  +This is shorter than the 840 in the original, as I found it ran off the
  +page and dirtied the second and subsequent pages.
  +
  +(3)DefaultPrinter: | lpr
  +
  +(3)Options: --lines-per-page=58
  +
  +Default printer pipes to the lpr script. I inserted the lines per page
  +to tweak down the length, as my printer default font is bigger than
  +a2ps thinks it is. The config file apparently takes any of the long
  +options as shown on the man page. The header/footer stuff is in Section
  +5 and I don't understand a word of it. (It seems patterned on the
  +twisted thinking  typical of sed expressions).
  +
  +With this, I can simply type
  +
  +a2ps <textfile>
  +
  +And I get a neat header, side borders, and page numbers. It goes off 
  +through lpr,  which wakes up ghostscript, but then we set lpr up, 
  +didn't we? The header has date, title, and page numbers.
   
  +Stop the stopwatch, e-mail me with your grateful thanks, praise, and
  +offers of gifts:-), & Cc to Uli Fahrenberg for the script.
   
  -Some day, someone may write a reliable printing program in linux, if it is
  -shorter than this people should convert. Mind you, this is pretty good. And 
  -it will be very difficult to be shorter.
   
   
  -Declan Moriarty.
  +	Declan Moriarty.
  
  
  
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message



More information about the hints mailing list