Can anyone recommend a pdf compressor and DT workflow?

@chrillek Nice one. Not surprisingly, it seems that AppleScript isn’t supported anyway :slight_smile:

I gather this compresses the existing file in DT3?

Is it possible to script this to duplicate the file in DT3 and act on the duplicate in case the compression quality is poor?

Is it possible to script this to duplicate the file in DT3 and act on the duplicate in case the compression quality is poor?

Are you going to spot-check every one?

If I am compressing non-public items which are important documents from a client? Yes

If they are more casual documents for personal reasons or easily re-downloaded? No

May I ask why you’d bother compressing important documents if there’s the potential for a poor result and it just adds to your workload?

Yes. I do occasionally duplicate a PDF in DT and then compress the original, just in case – as you say – the compression isn’t what I expected.

Certainly, though it would need someone with better scripting skills than mine. You’d have to tell PDF Shrink where to write the compressed file, and get DT to import it.

The advantage of PDF Shrink is that it’s properly scriptable. PDF Squeezer is cheaper and probably more elegant, but less easy to integrate. I have never had much success with Preview.app presets for compressing PDFs.

Because a single large document can approach 1/2 Gb to 1 Gb in size and that is a bit of a challenge to work in a team environment, especially with some of my staff working with home internet connections.

Usually it is possible to reduce the size to 20-30% of the original without losing quality, which is immensely helpful. But since the source of the documents varies, occasionally the compression is either unachievable or undesirable.

Thanks, but do you have any hints for suitable settings, especially when it comes to compressing images in PDFs?

I tried -sDEVICE=pdfwrite -r50x50 to set resolution to 50 ppi, but it didn’t make the file any smaller.

I am a great fan of Dr Drang, but I’m guessing their PDFs were bloated for a different reason.

  • Are these files collated from scanned data?
    • If so, what resolution are you scanning at?
  • Or are these including things like x-rays, etc.?

@Chazzo That makes sense

Actually Duplicate is in the DT3 Scripting Dictionary so it should be easy to do the duplication in DT3 before using PDF Shrink

I agree that scripting in PDF Shrink is a nice plus - I will give that a try

Thanks

That is totally beyond my control. I get records from attorneys, who get them from other attorneys or hospitals or doctors or from their clients… the quality varies enormously.

Understood and feels like my printing days :open_mouth: :slight_smile:

1 Like

1 Like

Nice script

But for some reason PDF Shrink rejects many of my PDFs due to the need for a password even when there is no password set. That said, it is notably slower than PDF Squeezer.

PDF Squeezer has a number of automation options as shown here FAQ but no Applescript support. There probably is a way to run it via Applescript using its command line ability but I did not try that yet.

That said, PDF Squeezer does have Shortcuts support.

Right now this short script does work to duplicate a PDF file:

tell application id "com.devon-technologies.think3"
	try
		set this_selection to the selection
		duplicate record this_selection to current group
	end try
end tell

It is also possible to execute PDF Squeezer via Macos Shortcuts:

The question is… how do I pass either the original or the duplicated PDF file to the PDF Squeezer shortcut?

What do you think of the numbers in my screencap?

Very nice - which app did you use for that?

Automator :stuck_out_tongue:

If you’d like to try it…

Bear in mind this does create a temp file and imports it. I don’t have a multi-gigabyte PDF so I can’t say how it will behave. However, I do have the action put the temp file in the Trash when it’s done. Also note, you’ll have to look at your toolbar to see if the Automator cogwheel is spinning.

Compress PDF.workflow.zip (330.5 KB)

The best results were obviously with JPEG-Least. You’ll have to test and see if that yields an acceptable result. And obviously it can be opened and inspected / edited.

1 Like

Interesting - thank you.

That is certainly convenient to be able to install in Automator - I will remember that for future automation tasks.

These results with 3 different applications (Automator, PDF Shrink, PDF Squeezer) are on a small file; the results are in similar proportions on larger files. PDF Squeezer consistently produces the smallest files; all produce acceptable output.

@BLUEFROG

I realized it may be possible to combine best options by adapting your Automator workflow to use PDFSqueezer since it has Automator support. But I am getting this error which I think is because the filename is not being passed correctly from DT3 to PDF Squeezer and I am not sure why. Thoughts? Workflow attached.


PDF Squeezer DT3.zip (260.1 KB)

I don’t have PDF Squeezer so I can’t test this out at this time… and I’m in bed :stuck_out_tongue: