Resampling PDF Images on command line

Discussion in 'Mac Programming' started by superscape, Sep 12, 2014.

  1. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #1
    Hi,

    I'm looking for a way to resample the images in a pdf file to reduce file size, ideally on the command line. The big issue seems to be finding a solution that doesn't destroy the layers within the PDF (or OCGs if you want to be pedantic!)

    I've tried converting the PDF file to PostsScript using pdf2ps and then using GhostScript like this...

    gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=myoutputfile.pdf -dPDFSETTINGS=/ebook myinputfile.ps

    ...to turn that Postscript back to a PDF which works nicely but I lose my Layers/OCGs.

    Does anyone know a way of doing this either on the command line or (gulp) via Objective-C?

    Thanks in advance,

    Rob
     
  2. superscape thread starter macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Update

    Best solutions so far is pdfToolbox from Callas. Works nicely but isn't free. :-(

    Still hoping someone knows a better (i.e free!) way.
     
  3. slayerizer macrumors 6502a

    slayerizer

    Joined:
    Nov 9, 2012
    Location:
    Canada
    #3

Share This Page