Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Documentation of PDF::GetImages is lack of some info concerning the 'optionals'

by jms53 (Monk)
on Feb 09, 2013 at 11:56 UTC ( #1017952=note: print w/ replies, xml ) Need Help??


in reply to Documentation of PDF::GetImages is lack of some info concerning the 'optionals'

"Argument is abs path to pdf file on disk. Optional argument, is path to a dir to which to send images extracted. Returns array ref with abs paths to images extracted."

did you try pdfimages($abs, $opt), where $abs is the variable with the absolute filepath to your pdf file, and $opt the optional destination folder?

J -


Comment on Re: Documentation of PDF::GetImages is lack of some info concerning the 'optionals'
Download Code
Re^2: Documentation of PDF::GetImages is lack of some info concerning the 'optionals'
by programmer.perl (Beadle) on Feb 09, 2013 at 12:08 UTC

    My last change of code:

    #!/usr/bin/perl -w use 5.010; use strict; use warnings; use Cwd qw(); use PDF::GetImages 'pdfimages'; my $path = Cwd::cwd(); my $abs = $path.'/file.pdf'; # filepath to pdf file my $opt = $path.'/processing/'; # new dir for output my $images = pdfimages($abs, $opt) or die($PDF::GetImages::errstr); scalar @$images or die("no images in $path"); for (@$images){print "$_\n";}

    Output in commandline is:
    "cant resolve /home/auu/Documents/Imag/processing/, should be able to, please notify PDF::GetImages AUTHOR at extractor.pl line 11"

    Enough codes make shapes. (Hamidjon)
      Did you try setting $abs and $opt as absolute paths?

      Also, as for your other question, unless I am mistaken, it creates an array of the images created in $opt ($path). therefore, if empty returns false and dies with the error message "no images in $path".
      J -

        I made such but there is no result:

        my $abs = '/home/auu/Documents/Imag/file.pdf'; my $opt = '/home/auu/Documents/Imag/newfolder/';
        Enough codes make shapes. (Hamidjon)
        It is working! The mistake was that I didn't create the folder, I thought that Perl will create if there is no folder... Now, I created manually the folder and all is working... now, I'll write the code that will create the folder...
        Enough codes make shapes. (Hamidjon)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017952]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2015-07-06 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls