Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello Monks,

Im back. Well, working with TK and I am trying to figure out a solution to be able to print a page. I tried WIN32::Printer but to no avail, I kept getting error -3 "Unable to connect to printer" I tried every possible solution (I think it might have to do with the fact that all printers are on a network and none are local to me) but anyway, I have since moved onto trying to build an HTML page and convert it to PDF, then linking to it from the program so they can print it.

I am getting this error:

Tk::Error: Can't write to '\CompletedOrder.gif-3128': Permission denie +d at C:/Perl/lib/LWP/ line 105. at C:/Perl/lib/LWP/UserAge line 891. at C:/Perl/site/lib/PDF/ line 141. LWP::UserAgent::mirror at C:/Perl/lib/LWP/ line 891 LWP::Simple::mirror at C:/Perl/lib/LWP/ line 91 PDF::FromHTML::Twig::__ANON__ at C:/Perl/site/lib/PDF/FromHTML/Twig.p +m line 192 XML::Twig::_twig_end at C:/Perl/site/lib/XML/ line 2295 XML::Parser::Expat::parse at C:/Perl/lib/XML/Parser/ line 474 XML::Parser::parse at C:/Perl/lib/XML/ line 192 Carp::croak at C:/Perl/site/lib/ line 100 XML::Twig::_croak at C:/Perl/site/lib/XML/ line 2821 XML::Twig::_checked_parse_result at C:/Perl/site/lib/XML/ line + 766 XML::Twig::parse at C:/Perl/site/lib/XML/ line 747 PDF::FromHTML::parse_file at C:/Perl/site/lib/PDF/ line 14 +1 PDF::FromHTML::convert at C:/Perl/site/lib/PDF/ line 172 main::ViewSingleOrder at C:\BLABAD~1\/ line 244

I am using the following code (Taken from CPans Docs):
my $pdf = PDF::FromHTML->new( encoding => 'utf-8' ); # Loading from a file: # $pdf->load_file('source.html'); # Or from a scalar reference: $pdf->load_file(\$page_html); # Perform the actual conversion: $pdf->convert( # With PDF::API2, font names such as 'traditional' also works Font => 'font.ttf', LineHeight => 10, Landscape => 1, ); # Write to a file: $pdf->write_file('target.pdf');

Thank you

In reply to PDFtoHTML Mod by randor

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (5)
    As of 2018-06-21 03:12 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (117 votes). Check out past polls.