in reply to How to export all images from pdf via perl?

The CAM::PDF module would be ideal for this, it even comes with a couple of utility scripts to get you started:

  • extractallimages.pl: Save copies of all PDF images to a directory.
  • extractjpgs.pl: Save copies of all PDF JPG images to a directory.
  • Also, I am sure this question has been asked a few times before, did you super search?

    Hope this helps

    Martin

    • Comment on Re: How to export all images from pdf via perl?

    Replies are listed 'Best First'.
    Re^2: How to export all images from pdf via perl?
    by Anonymous Monk on Oct 30, 2008 at 09:37 UTC
      Thanks for your response. Using "listimages.pl -v main.pdf" i got the following image details.
      "Image 1 page 1, (w,h)=(673,944), ref /Im1 = object 27, length 378633"
      But i don't know the command for to extract images from pdf using CAM::PDF. I used the following command.
      "extractallimages.pl -O main.pdf "D:\OUTPUT""
      Could you please advice me the correct format for to extract image from main.pdf.

        From the documentation I previously mentioned, the -O option only extracts images based on their index number within the PDF file, for example:

        ./extractallimages.pl -O 1 main.pdf /tmp

        will save only the first image to directory /tmp.

        Read the documentation again, it contains all of the information you need. Since you asked how to extract all of the images within a PDF, you don't need to specify the -O option.

        Update: Please pay attention to the part of the documentation which explains that the ImageMagick 'convert' program is a prerequisite.

        Hope this helps

        Martin

          As per your advice i used "extractallimages.pl -O 1 main.pdf /tmp". No error found but image not saved in the tmp path. Could you please help me to solve this problem. I installed "image magic 6.4.0-2 Q16".
          And also which option is suitable for to export all images from pdf file.

          Thanks,
          Prabudass