initial import
[HTML-AutoConvert.git] / lib / HTML / AutoConvert / poppler.pm
1 package HTML::AutoConvert::poppler;
2
3 =head1 NAME
4
5 HTML::AutoConvert::poppler - poppler (pdftohtml) plugin for HTML::AutoConvert
6
7 =head1 URL
8
9 poppler can be downloaded from http://poppler.freedesktop.org/ 
10
11 =cut
12
13 use strict;
14 use vars qw( %info );
15 use base 'HTML::AutoConvert::Run';
16
17 %info = (
18   'types'   => 'pdf',
19   'weight'  => 10,
20   'url'     => 'http://poppler.freedesktop.org/',
21 );
22
23 sub program { ( 'pdftohtml', '-stdout' ) }
24
25 #false laziness w/OpenOffice.pm
26 #sub html_convert {
27 #  my( $self, $file ) = ( shift, shift );
28 #  my $opt = ref($_[0]) ? shift : { @_ };
29 #
30 #  my $program = 'pdftohtml';
31 #
32 #  my $timeout = 60; #?
33 #
34 #  my($out, $err) = ( '', '' );
35 #  local($SIG{CHLD}) = sub {};
36 #  run( [ $program, $file ], \undef, \$out, \$err, timeout($timeout) )
37 #    or die "$program failed with exit status ". ( $? >> 8 ). ": $out\n";
38 #
39 #  ( my $outfile = $file ) =~ s/\.pdf$/.html/i
40 #    or die "poppler.pm called with non-PDF file?!";
41 #
42 #  my $html = slurp($outfile);
43 #
44 #  $html;
45 #
46 #}
47
48 1;