You can use pdftk on Heroku - it is pre-installed. You use it by wrapping it as a command line from your Ruby application.
For most pdftk commands pdftk you will use Tempfile s. Interpolate Tempfile#path in pdftk arguments.
`pdftk #{subcommand}` raise Exception unless $?.success?
In some cases, you will be able to process data using stdin and stdout rather than Tempfile s.
input = ... output = IO.popen "pdftk #{subcommand}", 'w+b' do |io| io.write input io.flush io.close_write io.read end
yfeldblum
source share