Skip to content

pdf to image saves only the last page when page_number=-1 (instead of saving all PDF pages in save_folder) #132

@anassibnoualii

Description

@anassibnoualii

Description

I'm currently using the pdf to image keyword as described in the documentation, which:

Converts pdf to image - .png format.
Args:
path (str): path to the .pdf file
save_folder (str): path to the save folder
name (str): name of the file of the image to be saved
number_page (str): page from the pdf document to be saved as image.
If value is -1, then saves all pages as separated .png files.

However, when I set page_number=-1, it does not save all pages. Instead, only the last page of the PDF is converted into a PNG file.

Environement

  • Python version: 3.11.13

  • Libraries used:

- watchui==2.0.13
- robotframework==7.3

Example Test Case

*** Settings ***
Documentation    Simple PDF to image conversion test
Library          WatchUI

*** Variables ***
${PDF_PATH}      ./pdf_test.pdf
${IMG_NAME}      image
${PAGE_NUMBER}   -1

*** Test Cases ***
Convert PDF To Image
    [Documentation]    Convert PDF file to image format
    pdf to image    ${PDF_PATH}    name=${IMG_NAME}  page_number=${PAGE_NUMBER}

Steps to reproduce :

  1. Download and extract the attached ZIP file watchui-pdf.zip

  2. Open a terminal and navigate into the project directory:

    cd watchui-pdf
  3. Install required dependencies:

    pip install -r requirements.txt
  4. Run the Robot Framework test:

    robot pdf-to-image.robot

Expected behavior
The script should generate multiple image files in the output folder:

image_1.png
image_2.png
image_3.png
...

Actual behavior

Only one image file is generated:

image.png

And it represents only the last page of the PDF.


Please let me know if I might be missing something.

Thanks for your time and for maintaining this valuable library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions