Help resizing a pdf
January 7, 2011 11:38 AM   Subscribe

Advice on resizing a pdf.

I'm generating a pdf plot from the statistics program R and it's huge (34MB). Is there any way that I can make the pdf smaller? The plot is a vector image, and I would like to keep it in this format. It's this big, as I am showing sub-plots of 40 variables v 40 variables (and printing it at A0).

By using Acrobat Pro, I can choose 'optimize' and this shrinks it down to a very manageable 3MB file size. As I don't have Acrobat Pro on my computer, I was wondering if there was anyway to do this using something open-source or free?
posted by a womble is an active kind of sloth to Computers & Internet (10 answers total) 1 user marked this as a favorite
 
Response by poster: Forgot to include that I am using a Mac with OSX.
posted by a womble is an active kind of sloth at 11:40 AM on January 7, 2011


Open it in Preview, do File > Save As. In the dialog box, try the Quartz filter "Reduce File Size" and see if that helps. Save it with a new name so you don't overwrite your existing file.
posted by bcwinters at 11:48 AM on January 7, 2011


Response by poster: bcwinters: Do you know if it is possible to do this from the command line? I did play around with doing this graphically, but preview takes a very long time to open and display this file, and everything else snarls up in the process.
posted by a womble is an active kind of sloth at 11:54 AM on January 7, 2011


Best answer: The main culprit for large PDFs is bitmap graphics. (JPGs, TIFs, etc.) I don't know what R's PDF export options are, or how many embedded graphics you have, but some programs will automatically render their output to bitmaps instead of preserving vectors or fonts. Are you using R's export function or OSX's "print-to-PDF"?
posted by lekvar at 11:58 AM on January 7, 2011


You can use quartz filters from the command line, sure. Found a blog post titled "Compress PDF files with Quartz filters from command line" with some pointers that might help.
posted by bcwinters at 12:07 PM on January 7, 2011


Response by poster: lekvar, my R code is structured as follows:

pdf( plotName, height=12,width=16)
print( plot() )
dev.off()

which I believe produces a vector file. At least for smaller sizes I've never had much trouble with it resizing and rescaling.

thanks bcwinters, I'm tying that out at the moment (though i have not yet succeeded in getting this to run as '/System/Library/Printers/Libraries/quartzfilter' or 'System/Library/Printers/Libraries/./quartzfilter' are both throwing errors).
posted by a womble is an active kind of sloth at 12:45 PM on January 7, 2011


Response by poster: And it appears this is because quartzfilter has been removed from osx 10.6....
posted by a womble is an active kind of sloth at 12:53 PM on January 7, 2011


My understanding is that the way Quartz Filter reduces PDF file size is by compressing any embedded JPGs, not postscripts/vector/text. You can snag the library from any 10.5 home folder backups you might have and give it a shot though.

Is your printer encountering any memory problems with that size file?
posted by fontophilic at 1:27 PM on January 7, 2011


Best answer: If you don't mind putting it somewhere public, I can take a quick look at it to try to determine where the bulk is coming from. I can try to optimize it for you too, but that won't answer your question.
posted by lekvar at 2:45 PM on January 7, 2011


Response by poster: Thanks for the kind offer lekvar, but I don't think it's worth optimizing. It's a bit inconvenient for me to have to use another computer to resize, but it's really not a huge issue.

I also suspect that the reason it is so large is that it is 30 x 30 plots (90 plots), each showing 1000 points. I'll experiment with non-vector formats of low-res to see if I can come with a satisfactory solution.
posted by a womble is an active kind of sloth at 6:21 AM on January 9, 2011


« Older Tik Tok is a sad song??   |   Stripped Down Logos Newer »
This thread is closed to new comments.