Results 1 to 17 of 17

Thread: Convert all jpg and pdf files from folder into 1 single pdf with same width

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    Banned VBAX Regular
    Joined
    Aug 2023
    Posts
    9
    Location
    Quote Originally Posted by mihailovici View Post
    Cheers everyone,

    Does anyone know how to use code to automatically convert all jpg files and pdf files from a specific folder into 1 single pdf file ( with page marginalization - keeping the same width as the first page )

    Thanks
    God Bless
    Explanation of the Code


    1. Input Files:
      • The script scans the specified folder for .jpg, .jpeg, and .pdf files.
      • Files are processed in alphabetical order.

    2. Image Conversion:
      • JPEG images are opened using Pillow (PIL), converted to RGB, and resized to match the width of the first image or PDF page.

    3. PDF Integration:
      • Existing PDFs are resized to match the base width while maintaining aspect ratios.
      • The pages are added to the combined PDF sequentially.

    4. Output:
      • The combined PDF is saved to the specified file.
    Last edited by Aussiebear; 01-03-2025 at 03:56 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •