command line – AppleScript that reduces the dimensions of a number of PDF information fails

0
17
command line – AppleScript that reduces the dimensions of a number of PDF information fails


There’s rather a lot to unpack right here:

Firstly, Automator has an Apply Quartz Filter motion, which is quite a bit simpler to person than AppleScript. (Quartz Filters are an OS function, not simply Preview’s.)

Secondly, the OS-bundled filter to Scale back file dimension is well-known for being horrible, and you’ll find numerous third-party filters that present higher settings. Or you’ll be able to create your individual filter in ColorSync Utility, as per my reply right here.

Thirdly, Apple made numerous modifications to PDFKit in Sierra, and with that got here many bugs in PDF creation and manipulation. Most of those have been mounted in Excessive Sierra, however some lingered till Mojave. Any Mac operating Sierra needs to be able to operating Excessive Sierra, not less than.

If there is a compelling purpose why it’s essential keep on Sierra, then I would recommend downloading a appropriate model of GhostScript, which ought to be capable of batch-compress PDFs very simply.

Additionally, it appears such as you’re utilizing a Visitor person account? (Except that is your identify.) It is attainable {that a} visitor account has restricted permissions, which could trigger issues.

As for the AppleScript itself, it appears like there is not any such command as export within the Preview AS dictionary. (There is not in Sonoma, not less than: however you must examine the dictionary in Sierra.)

One closing factor about your shell script: The ‘bizarre characters’ within the Terminal output have been really the information contents of the PDF file being written to stdout. The -o flag passes choices to the print driver; it would not set the output file. Additionally -p units the PPD for use. You’ll be able to’t apply a Quartz Filter to cupsfilter. (CUPS has its personal ‘filters’, that are a very totally different factor.)

One thing which may be helpful is that this python script, which you should utilize on the command line to use quartz filters to PDFs. It makes use of the system python2, so that you need not set up something.
https://github.com/benwiggy/PDFsuite/blob/grasp/legacypercent20(pythonpercent202)/Shell_Scripts/quartzfilter.py

LEAVE A REPLY

Please enter your comment!
Please enter your name here