Pod-Pdf
view release on metacpan or search on metacpan
my $was_item = 0; # Last heading was an '=item'
my $bl = 0; # blank line flag
my $zlf = 1; # zero line feed flag
my $for = 0; # '=for' block flag
my $special = 0; # '=begin' block flag
my $j = 0; # scratch-pad index
my $p = 0; # scratch-pad indeces
my @jt = (); # scratch-pad pointers
my @pt = (); # scratch-pad pointers
my @scratch_pad = (); # scratch pad
my @sc = (); # colour scratch-pad
my $sp = 1; # Starting page number
my $lp = 0; # Last page number of document section
my $page = 1; # Current page number (start at 1)
my $start_page = 1; # start page number
my $ypos = 0; # Current height on page (pixels)
my $xpos = 0; # Current line position
my $yrem = 0; # Height currently remaining on page
my $inside_margin = 72; # Inside page margin
my $outside_margin = 72; # Outside page margin
my $left_margin = 72; # Left margin
my $right_margin = 72; # Right margin
my $end = 0; # Position of end of line
my $top_margin = 72; # top page margin for body text
my $bottom_margin = 62; # bottom page margin for body text
my $top_bar = 50; # distance from top of page to header bar
my $bottom_bar = 50; # distance from bottom of page to footer bar
my $left_indent = 30; # Amount by which to indent everything but H1 and H2
my $leading = 1.2; # multiply by current fontsize to get line spacing
my $paragraph_space = 0.5; # multiply by line spacing to get space between paragaphs
my $tab_per_char = 6; # points per character multiplier for tab stops
my $heading_lift = 0.2; # multiply by line spacing to get extra space under heading
my $index_indent = 20; # Amount to indent for every new level of ToC
my $LF = 0; # Line feed == $leading * $fs;
my $uH = 0; # Heading lift == $LF * $heading_lift;
my $WS = 0; # White Space == $LF * $paragraph_space;
my $cLM = 0; # Current left margin on page
my $set = 0; # Tab stop number
my @ov = (); # Tab position array
my $indent = 0, # Current tab indent (in points)
my $lineleng = 0; # Current linelength in points
my $line = ''; # String
my $k = 0; # Line length error per space
my $k_max = 5; # if $k > $k_max the line is not justified
my $spaces = 0; # Count of spaces in line
my $fs = 0; # Font size
my @lk = (); # List of links
my $in_link = 0; # Processing link (flag)
my $link_string = ''; # Link string
my $wordleng = 0; # Word length (used in sub 'just')
my $tab_str = 0; # Flag for string containing a tab character
my @annot = (); # List of 'link' annotations
my $current_color = 0;
my $date = ''; # Footer date string
my $h_str = 'pod2pdf'; # Inside string for header
my $section = ''; # Section type: 'doc', 'cat', 'ind', etc.
sub pod2pdf {
local @ARGV = @_;
unless ( @ARGV && $ARGV[0] ) { die "no input, no output!\n" }
parse_command_line();
unless ($ARGV[0]) {
$in_file = '-' unless $in_file
}
else {
$in_file = $ARGV[0]
}
$title = basename($in_file);
$dir = dirname($in_file);
$title = pdfEscape($title);
$out_file = $in_file.'.pdf';
$date = page_date();
define_variables();
#$start_time = (times)[0]; # fails on Windows perl 5.003
$start_time = time;
pdfOpen($out_file);
pdfOutline(0, 'Table of Contents', undef, $y_size);
$section = 'doc';
my $in_pod = 0;
my $pod_found = 0;
readFile($in_file);
unless ($page % 2) {
pageHeader($h_str, $title);
pageFooter();
$lp++;
}
$section = 'toc';
buildTOC();
$section = 'cov';
coverPage();
outlineTree();
pdfTrailer();
#my $finish = (times)[0];
my $finish = time;
printf( STDERR "PDF generation time = %4.2f sec)\n", $finish - $start_time ) if $verbose;
exit 0;
}
sub parse_command_line {
my( $opt_paper, $opt_help, $result);
my $usage = qq{
$0
[ --help --verbose <1|2 --paper <usletter> --podfile <file> ] <file>
--help
displays this explanation of correct usage
( run in 1.409 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )