syncing up with 2.2
[Samba/gbeck.git] / docs / docbook / scripts / ldp_print
blob70bb801def48521a1fc5388db5fba6cbbf2844b2
1 #!/usr/bin/perl -w
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).
16 # CAVEATS:
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)
39 use strict;
40 push(@INC, "./");
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 "--firstpage p1 --titlefile title.html body.html";
58 # For postscript output; append onto the above cmd string:
60 # "; htmldoc --size universal -t ps -f -f ${fname_wo_ext}.ps " .
61 # "--firstpage p1 --titlefile title.html body.html";
63 system($cmd);
64 die "\nldp_print: could not create ${fname_wo_ext}.pdf ($!)\n" if ($?);
66 # cleanup
68 system("rm -f body.html title.html");
70 exit(0);