Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rotate pdf document #42

Open
gurdipe opened this issue Aug 26, 2014 · 1 comment
Open

rotate pdf document #42

gurdipe opened this issue Aug 26, 2014 · 1 comment

Comments

@gurdipe
Copy link

gurdipe commented Aug 26, 2014

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

@tcocca
Copy link
Owner

tcocca commented Aug 29, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants