THANK YOU! This fixed a lot of my headaches. I wrote html2pdf.pl with this as base, which works with files as well as with URL's:

#!/usr/bin/perl use 5.14.2; use warnings; our $VERSION = "0.01 - 20191210"; our $CMD = $0 =~ s{.*/}{}r; sub usage { my $err = shift and select STDERR; say "usage: $CMD [-p A4] [-f] [-o file.pdf] file.html"; say " -p size --page-size=size Set page size. Default = A4" +; say " -o out --out=out Set ouput file name. Default + = s{.html\$}{.pdf}"; say " -f --force Overwrite out if exists"; exit $err; } # usage use Data::Peek; use PDF::WebKit; use Getopt::Long qw(:config bundling); GetOptions ( "help|?" => sub { usage (0); }, "V|version" => sub { say "$CMD [$VERSION]"; exit 0; }, "f|force!" => \ my $opt_f, "p|page-size=s" => \(my $page_size = "A4"), "o|out|pdf=s" => \ my $pdff, "v|verbose:1" => \(my $opt_v = 0), ) or usage (1); my $html = shift or usage (1); $pdff ||= $html =~ s{\.html?$}{.pdf}ri =~ s{.*/}{}r; -s $pdff && !$opt_f and die "$pdff already exists\n"; unlink $pdff; PDF::WebKit->new ($html, page_size => $page_size)->to_file ($pdff);

Images, colors *and* fonts are correct, which I cannot say for the very broken htmldoc and html2ps tools.


Enjoy, Have FUN! H.Merijn

In reply to Re^2: printing metacpan by Tux
in thread printing metacpan by lee_crites

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.