Linux HOWTOs

About | Home | Search

HOWTO: html2ps
Description: A Perl-based HTML to PostScript converter
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# html2ps 1.0b7
# =============
# If you want to uninstall html2ps or clean up files from an old version
# before installing a new one, skip down to the bottom for instructions.

# Prerequisites:
# Perl >= 5.0
# ImageMagick, pbmplus, or netpbm (for image conversion)
# libwww-perl (LWP), wget, or lynx (for remote documents)
# Ghostscript (for cross references and PostScript)
# TeX dvips (for math conversion)
# Tcl/Tk (for xhtml2ps GUI)

# Get it
test -f installed/html2ps-1.0b7.tar.gz &&
 mv installed/html2ps-1.0b7.tar.gz .
test ! -f html2ps-1.0b7.tar.gz &&

# Extract the source
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "html2ps-*" -exec rm -r {} \;
tar xzvf ~/html2ps-1.0b7.tar.gz
cd html2ps-1.0b7
test $UID = 0 && chown -R root:root .

# Become root to install it

# Install/upgrade Perl modules
perl -MCPAN -e shell
install Bundle::CPAN
install Bundle::LWP

# Install the html2ps program and man pages:
install -m 755 ./html2ps /usr/local/bin/
install -m 644 ./html2ps.1 /usr/local/man/man1/
install -m 644 ./html2psrc.5 /usr/local/man/man5/

# If you want to install the xhtml2ps GUI:
install -m 755 contrib/xhtml2ps/xhtml2ps /usr/local/bin/

# Install documentation files
install -d /usr/local/doc/html2ps-1.0b7 /usr/local/doc/html2ps-1.0b7/contrib
install -m 644 COPYING README html2ps.html sample hyphen.tex \
( cd contrib/xhtml2ps
  install -m 644 LICENSE README xhtml2ps \
   /usr/local/doc/html2ps-1.0b7/contrib/ )

# See the documentation in /usr/local/doc/html2ps-1.0b7
# and read 'man html2ps' and 'man html2psrc'

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again

# Save the tarball for later
mkdir -p -m 0700 installed
rm -f installed/html2ps-*.tar.*
mv html2ps-1.0b7.tar.gz installed/

# If you ever want to uninstall html2ps, this should do it:
find /usr/local/doc -maxdepth 1 -type d -name "html2ps-*" -exec rm -r {} \;
rm -f /usr/local/bin/html2ps /usr/local/bin/xhtml2ps \
 /usr/local/man/man1/html2ps.1 /usr/local/man/man5/html2psrc.5
find ~/src -maxdepth 1 -type d -name "html2ps-*" -exec rm -r {} \;
rm -f ~/installed/html2ps-*.tar.*

Back to the list

Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>