Convert a batch of jpgs into pdfs

Greetings all.

Has anyone used automator to convert a batch of jpg's into PDFs? (I am looking to do a 1 to 1 conversion, not merge multiple JPG's into 1 PDF).

I have over 1000 jogs that I have to convert, and I need to do preserve the file name. If anyone has been successful with this, would you be willing to share how you did it?


Thanks in advance and regards,

AJ

MacBook Pro with Retina display, OS X Mavericks (10.9.3)

Posted on Sep 14, 2015 5:33 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 15, 2015 9:35 PM

Hi,


Firecop1 wrote:


This did it! I went with your second option. I worked for jpgs but not jpegs. How would I modify it to convert both without having to go back in and change .jpg in the first line to .jpeg?


Thanks

AJ


Like this:

cd "$@" && for f in *.{jpeg,jpg}
do
    sips -i -s format pdf "$f" -o "${f%.*}".pdf
done


No error when the folder doesn't contains a ".jpeg" file, but an error will occur if you do not have at least one ".jpg" file in the folder.



------

If you do not want to get error when the folder contains no ".jpg" file or neither, use this script:

shopt -s nullglob
cd "$@" && for f in *.{jpeg,jpg}
do
    sips -i -s format pdf "$f" -o "${f%.*}".pdf
done
29 replies

Jul 13, 2017 6:51 PM in response to Firecop1

Hi all, I realize this thread is a couple of years old, but I'm trying to achieve the same thing and having a couple of problems with Jacques Rioux's (excellent) script.


The script runs, and does indeed convert the file,

however, in the finder if the file is named "filename.jpg"

it converts to a pdf of the same name (is this because I have the file suffixes showing?)

anyway, the result is then a pdf file with a .jpg name which is unreadable in preview until i manually change the name to "filename.pdf"

any suggestions on this would be greatly appreciated!

Jul 13, 2017 6:54 PM in response to Jacques Rioux

Hi all, I realize this thread is a couple of years old, but I'm trying to achieve the same thing and having a couple of problems with Jacques Rioux's (excellent) script.


The script runs, and does indeed convert the file,

however, in the finder if the file is named "filename.jpg"

it converts to a pdf of the same name (is this because I have the file suffixes showing?)

anyway, the result is then a pdf file with a .jpg name which is unreadable in preview until i manually change the name to "filename.pdf"

any suggestions on this would be greatly appreciated!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Convert a batch of jpgs into pdfs

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.