in reply to PDF generation based on the HTML

I had to clean the script up a little, but it works. It produces a test.pdf that is aligned. For the input file, I used the source for your post:
#!/usr/bin/perl use strict; use warnings; use HTML::HTMLDoc; open( 'OUTHTML', '>>', 'test.html' ); my @pdf_lines = <OUTHTML>; close(OUTHTML); my $htmldoc = new HTML::HTMLDoc(); $htmldoc->set_html_content(qq~<html><body>A PDF File</body></html>~); $htmldoc->set_input_file('/user/Desktop/PDF'); $htmldoc->set_page_size('letter'); $htmldoc->set_top_margin( 'top', -500, -500 ); $htmldoc->set_bottom_margin( 'bottom', -500, -500 ); $htmldoc->set_left_margin( 'left', -400, -400 ); $htmldoc->set_right_margin( 'right', -400, -400 ); $htmldoc->set_pagemode( 'pagemode', 'fullscreen' ); $htmldoc->set_html_content(qq~@pdf_lines~); $htmldoc->get_html_content(); $htmldoc->get_input_file(); $htmldoc->set_header( '.', '.', '.' ); $htmldoc->set_footer( '.', '.', '.' ); $htmldoc->embed_fonts( 'embedfonts', '' ); $htmldoc->no_embed_fonts(); my $pdf = $htmldoc->generate_pdf(); $pdf->to_file('test.pdf');

Replies are listed 'Best First'.
Re^2: PDF generation based on the HTML
by johngg (Canon) on Jan 30, 2010 at 17:15 UTC
    open( 'OUTHTML', '>>', 'test.html' ); my @pdf_lines = <OUTHTML>;

    That looks a bit weird to me but maybe I've missed something. Why are you opening the file for write appending and then trying to read from it. Also, why are you single-quoting the filehandle in the open statement? I don't think that's necessary.

    Cheers,

    JohnGG