active_pdftk icon indicating copy to clipboard operation
active_pdftk copied to clipboard

rotate pdf document

Open gurdipe opened this issue 11 years ago • 1 comments

Sorry for the simple question

I am trying to rotate a generated pdf document in a ruby on rails application by 180 but unsure of the the ruby .cat command

I can rotate the pdf via the command line using the following command:

pdftk in.pdf cat 1-endsouth output out.pdf

but do not know how to convert this command to a ruby command using active_pdftk

gurdipe avatar Aug 26 '14 13:08 gurdipe

I believe it would look something like this:

pdftk = ActivePdftk::Wrapper.new pdftk.cat([{:pdf => 'in.pdf', :start => 1, :end => 'end', :orientation => 'south'}], :output => 'out.pdf')

If that doesn't work let me know. Also if you are going to use paths for input and output they should be full paths to the files. If you do not specify an output option then it will default to a StringIO response that you can work with. You could also pass in a File or Tempfile object to output if you wish.

The Wrapper class provides a neat wrapper for each method around the Call class which does all the major work: https://github.com/tcocca/active_pdftk/blob/master/lib/active_pdftk/call.rb#L116

tcocca avatar Aug 29 '14 04:08 tcocca