Skip to content

Extract and save images from a PDF

This article explains how to extract the images contained in a saved PDF file and save them as image files.

About the “Extract images from PDF” action

Section titled “About the “Extract images from PDF” action”

The action used in this article is “Extract images from PDF”.

The action has the following parameters.

Parameter Value
PDF file The path of the PDF file to extract images from
Page(s) to extract Choose whether to extract images from all pages, a single page, or a range of pages
Image(s) name The beginning of the file names for the extracted images (sequential numbers are added, as in “converted_1”, “converted_2”)
Save image(s) to The folder where the extracted images (in PNG format) are saved
Password Shown under “Advanced”. Specify it if the PDF is password-protected

action

As a sample, here’s a flow that extracts images from a PDF file saved in the Public Documents folder and saves them in the same folder.

Copy the following code and paste it into the Power Automate Desktop flow designer to add the action.

Pdf.ExtractImagesFromPDF.ExtractImages PDFFile: $'''C:\\Users\\Public\\Documents\\target.pdf''' ImagesName: $'''converted''' ImagesFolder: $'''C:\\Users\\Public\\Documents'''
  1. In “Search actions”, type “Extract images from PDF”.

  2. Set the parameters as follows.

    Parameter Value
    PDF file C:\Users\Public\Documents\target.pdf
    Page(s) to extract All
    Image(s) name converted
    Save image(s) to C:\Users\Public\Documents
  3. When you run the flow, the images extracted from the specified PDF file are saved in the specified folder.

One possible cause of errors is a password-protected PDF. If the PDF is password-protected and no password is set, or the password is wrong, an error occurs.

An error also occurs if the specified PDF file or destination folder doesn’t exist, or if images can’t be extracted from the PDF successfully.

If extracting the images isn’t essential, we recommend setting up error handling with an “On block error” block.