summaryrefslogtreecommitdiff
path: root/lib/HTML/AutoConvert/poppler.pm
blob: cca5b0de5372e36c6b566c1d39f340b3156b91d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package HTML::AutoConvert::poppler;

=head1 NAME

HTML::AutoConvert::poppler - poppler (pdftohtml) plugin for HTML::AutoConvert

=head1 URL

poppler can be downloaded from http://poppler.freedesktop.org/ 

=cut

use strict;
use vars qw( %info );
use base 'HTML::AutoConvert::Run';

%info = (
  'types'   => 'pdf',
  'weight'  => 10,
  'url'     => 'http://poppler.freedesktop.org/',
);

sub program { ( 'pdftohtml', '-stdout' ) }

#false laziness w/OpenOffice.pm
#sub html_convert {
#  my( $self, $file ) = ( shift, shift );
#  my $opt = ref($_[0]) ? shift : { @_ };
#
#  my $program = 'pdftohtml';
#
#  my $timeout = 60; #?
#
#  my($out, $err) = ( '', '' );
#  local($SIG{CHLD}) = sub {};
#  run( [ $program, $file ], \undef, \$out, \$err, timeout($timeout) )
#    or die "$program failed with exit status ". ( $? >> 8 ). ": $out\n";
#
#  ( my $outfile = $file ) =~ s/\.pdf$/.html/i
#    or die "poppler.pm called with non-PDF file?!";
#
#  my $html = slurp($outfile);
#
#  $html;
#
#}

1;