3 # usage: ldp_print <single_file.html>
5 # Creates a PDF variant of a single-file HTML representation of a
6 # DocBook SGML (or XML) instance. This simple wrapper assumes that
7 # the file was created using {open}jade in a manner similar to:
9 # jade -t sgml -i html -V nochunks -d $style $fname > $fname.html
11 # Give this script the filename as an argument. It will then parse
12 # the file into 'title.html' and 'body.html' and send each to
13 # htmldoc (as the corresponding title page and body of the document).
18 # Assumes perl is in /usr/bin; adjust if necessary
20 # You may need to specify where the htmldoc executable resides.
21 # The script assumes it's within your $PATH.
23 # If you want Postscript as an output variant, uncomment the
24 # appropriate lines (see below).
26 # Relies on output from a DocBook instance created via DSSSL/{open}jade!
28 # Cleans up (removes) the intermediate files it creates (but not the
29 # PDF or Postscript files, obviously!)
31 # Works silently; PDF (PostScript) will be created in the same directory
32 # as was specified for the input (single-file HTML) file.
34 # Provided without warranty or support!
36 # gferg@sgi.com / Ferg (used as part of the LDP production env)
41 require 'fix_print_html.lib';
43 if( $ARGV[0] eq '' || !(-r $ARGV[0]) ) {
44 die "\nusage: ldp_print <single_file.html>\n\n";
47 my($fname_wo_ext) = $ARGV[0];
48 $fname_wo_ext =~ s/\.[\w]+$//;
51 # create new files from single HTML file to use for print
53 &fix_print_html($ARGV[0], 'body.html', 'title.html');
55 my($cmd) = "htmldoc --size universal -t pdf -f ${fname_wo_ext}.pdf " .
56 "--linkcolor #0000ff ".
57 "--firstpage p1 --titlefile title.html body.html --footer c.1";
59 # For postscript output; append onto the above cmd string:
61 # "; htmldoc --size universal -t ps -f ${fname_wo_ext}.ps " .
62 # "--firstpage p1 --titlefile title.html body.html";
65 die "\nldp_print: could not create ${fname_wo_ext}.pdf ($!)\n" if ($?);
69 system("rm -f body.html title.html");