Is it possible to write a macro to cut out the white margins of a PDF document?

I would like to systematically take out most of the white margins, without the fixed margin constraints of cropping.

Thanks very much

Hey Ronald,

You can’t do it with Keyboard Maestro.

It’s possible that some software out there can be driven BY Keyboard Maestro to do it.

It’s also possible there are command-line programs that could be scripted to do so.

Here’s one article that may be germane:

It looks like the command-line tool ImageMagick might be able to do it:

You’ll have to dig around and see.

-Chris

1 Like

That’s what Chris has said (line 3 in his post).

The OP asked for PDF. If you run your script on a PDF it will rasterize the whole PDF.

In general I wouldn’t use ImageMagick on PDFs. ImageMagick excels on images, but PDFs are not images. A better tool for PDFs is for example Ghostscript. (If you use ImageMagick on PDFs it will also use Ghostscript.)

1 Like

Best thing about this forum are the opinion correctors.

1 Like

Huh? No reason to delete your post.

Your script works fine for JPEGs. The problem is that it also runs on PDFs, but in the process destroying all text and vector objects. And some users may not be aware of it, until they zoom in.

1 Like