Skip to content

Conversation

@Skillkiller
Copy link

@Skillkiller Skillkiller commented Dec 2, 2025

Description

This update adjusts the behavior of the PDF-to-Image functions as follows:

  • Added loader progress messages
  • Single-page PDFs now return the generated image file (PNG/JPG/WebP/TIFF/BMP) directly instead of providing a ZIP file.
  • Multi-page PDFs continue to be delivered as a ZIP archive containing all page images.
  • The output filenames are now consistently based on the name of the input PDF.
    Before adding the file extension or ZIP suffix, the base filename is cleaned by:
    • removing the .pdf extension
    • trimming whitespace
    • limiting the resulting name to a maximum of 80 characters

Output filename examples:

  • One page.pdfOne page.jpg
  • Multiple pages.pdfMultiple pages_jpgs.zip
  • Very long filename ................................................test.pdf
    → base filename is trimmed to 80 characters before adding .png or _pngs.zip

Video example:
Recording 2025-12-02 at 9.35.3 PM.webm
(This video does not show the changed progress messages because they were only added after a review.)

These changes were applied to the following modules:

  • pdf-to-jpg
  • pdf-to-png
  • pdf-to-webp
  • pdf-to-tiff
  • pdf-to-bmp

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Since the return format for single-page PDFs has changed, this update is marked as a Breaking Change.

🧪 How Has This Been Tested?

The changes were verified through manual testing across all affected modules.
For each module, the following tests were performed:

  1. Single-page PDF

    • Selected One page.pdf and ran the conversion.
    • Confirmed that the output is a single image file (not a ZIP).
    • Verified that the filename is cleaned and correctly derived from the input PDF.
  2. Multi-page PDF

    • Selected Multiple pages.pdf and ran the conversion.
    • Confirmed that the output is a ZIP file and correctly named.
    • Verified that the ZIP contains the expected image files for each page.

Checklist:

  • Verified output manually
  • Tested with relevant sample documents or data
  • Wrote Vite Test Case (if applicable)

Test PDF files:
One page.pdf
Multiple pages.pdf

Expected Results:

  • Single-page PDFs

    • The converter returns a single image file (PNG/JPG/WebP/TIFF/BMP depending on the module).
    • The output file is not zipped.
    • The base filename is cleaned using the following rules:
      • .pdf extension removed
      • whitespace trimmed
      • filename limited to max. 80 characters
    • The final filename adds the correct extension, e.g.:
      One page.pdfOne page.png
      Very long filename (over 80 chars).pdf<cleaned_80_char_name>.png
  • Multi-page PDFs

    • The converter returns a ZIP archive.
    • The ZIP filename uses the same cleaning rules:
      • remove .pdf
      • trim whitespace
      • limit to 80 characters
    • The final ZIP name is constructed as:
      cleanname_pngs.zip
    • The ZIP contains one image per page, each based on the cleaned filename.

These results should remain consistent across all updated modules.

Actual Results:

  • As expected

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
    (Only tests already failing on main are failing)
  • Any dependent changes have been merged and published in downstream modules

@Skillkiller
Copy link
Author

Thank you for your feedback @renierr. I'll take care of it tomorrow.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Skillkiller
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Dec 5, 2025
@Skillkiller
Copy link
Author

I have also added progress messages to the loader popup for all PDF to Image functions. The PR description will be adjusted accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants