![]() ![]() This is actually very straightforward, and writing a tool to parse command line arguments that provide a source folder of JPEGs, and a destination folder and name for the PDF file, proved easy thanks to the Quartz framework’s PDFPage and PDFDocument objects. I wanted to write it in Swift - and learn how to create a macOS command line project in Xcode. This is possible to do in Python, but it introduces dependencies to allow Python to make use of the macOS SDK’s Objective-C methods. Weve covered batch converting and resizing images on a Mac by creating an application in Automator. ![]() This is no longer the case, at least in Mojave and above. ![]() Older versions of Automator’s PDF creation and Quartz filter application actions were written in Python, which you could extract by digging into macOS’ System folder. This will convert an image to PDF, but it’s not able (it seems tell me if I’m wrong) to convert multiple images into one PDF, which is what I want to do. Having spent some time over the past year writing bash scripts for a variety of other tasks - for example, the one outlined in a previous post - I decided to see if I could replace the Automator workflow with something able to take input when it’s run.įor image manipulation, I make extensive use of macOS’ built-in sips tool. There is a Automator action called Compress Images in PDF Documents, but I found that it doesn’t appear to compress the images: choose any of its settings, and the output PDF is always the same size! My approach was to write an Automator workflow to select the images, put them in alphabetical order of filename, write them to PDF and then apply a custom Quartz filter to the PDF. Yes, this method works, but it doesn’t give you much control over the process, and it’s not scriptable. Google the title of this post and you will get plenty of results, but all almost all of them steer you toward opening the image or images in macOS’ Preview app and exporting to PDF. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |