2

I've got a pdf figure with millions of semi-transparent points that I made in R. I want to flatten it to reduce filesize and then export it back out as a PDF (as a vector still, not a bitmap).

If there is a command line option, I can run it from within R using a system() call. Is there a way to do this?

1 Answers1

2

I would look at exporting from R in SVG (PDF will work, but SVG is easier to wrangle, being text based) and then run that through Inkscape.

Inkscape? A graphical application, Oli? Are you mad?

Actually Inkscape can be run from the command line to do batch operations. I use it like that on a server (called from Python) to generate PDF certificates for a client of mine. Here's its man page.

It's most comfortable with SVG. If your input is an SVG you can vacuum-defs and export as PDF in one swift motion.

Oli
  • 299,380