Skip Menu |

This queue is for tickets about the HTML-HTMLDoc CPAN distribution.

Report information
The Basics
Id: 49700
Status: open
Priority: 0/
Queue: HTML-HTMLDoc

People
Owner: MFRANKL [...] cpan.org
Requestors: perlcat [...] windstream.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: windows pdf writing bugs
Date: Mon, 14 Sep 2009 15:22:20 -0500
To: bug-HTML-HTMLDoc [...] rt.cpan.org
From: Tyson Boellstorff <perlcat [...] windstream.net>
This code works great on unix (FreeBSD): { my ($handle)=@_; my $htmldoc = new HTML::HTMLDoc(); $htmldoc->set_input_file($handle->{'html.path'}[0]); my $pdf = $htmldoc->generate_pdf(); $pdf->to_file($handle->{'pdf.path'}[0]); return $handle; } In order to avoid writing broken files in windows, { my ($handle)=@_; my $htmldoc = new HTML::HTMLDoc(); open FH, '>', $handle->{'pdf.path'}[0]; binmode FH; $htmldoc->set_input_file($handle->{'html.path'}[0]); my $pdf = $htmldoc->generate_pdf(); print FH $pdf->to_string(); close FH; return $handle; } This writes the document as a pdf document including images, but no text. This code also fails to write the text in the document: { my ($handle)=@_; my $htmldoc = new HTML::HTMLDoc(); open FH, '>', $handle->{'pdf.path'}[0]; binmode FH; $htmldoc->set_html_content(qq~<html><body>A PDF file</body></html>~); my $pdf = $htmldoc->generate_pdf(); print FH $pdf->to_string(); close FH; return $handle; } THis works every time, but defeats the purpose: { my ($handle)=@_; my $err=qx(htmldoc --webpage -f $handle->{'html.path'}[0] $handle->{'html.path'}[0]); return $handle; } I've tried setting the font to arial with no change -- wondering if it's environment, but I saw no fontpath settings to add to the HTML::HTMLDoc objects. Anyway, having to set binmode on a windows pdf to write it seems like a bug to me, but even if that gets fixed, I'd need to get the text to print, or use Image::Magick to generate the whole document from scratch. I have sample output if you want. Thanks, Tyson Boellstorff