in reply to Reading output of external program without Shell
Thank you all!
At the end I opted for writing the content of the PDF in a temp file and read it again. Not very elegant thought...
use strict; use warnings; use File::Temp qw(tempfile); my $temp = new File::Temp( UNLINK => 0, SUFFIX => '.txt' ); system ("pdftotext","-enc", "UTF-8","myfile.pdf","$temp"); local $/=undef; open(my $fh, '<:encoding(UTF-8)', $temp) or die "Could not open file ' +$temp' $!"; print my $string = <$fh>;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading output of external program without Shell
by haukex (Archbishop) on Nov 15, 2017 at 13:47 UTC | |
by Anonymous Monk on Nov 15, 2017 at 15:11 UTC |