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