A
Adam Groves
Hi,
I'm wanting to create thumbnails of pdfs in png format and send them off
to be saved. I've come up with this so far:
IO.popen("curl #{some_uri} | convert -resize 700x700 pdf:-[0]
png:-") {|f| do_something_with_this_file}
Which works a treat. (In case you didn't know, convert is a command line
tool for ImageMagick).
What I'd really like to do though is pass on a File object to convert:
file = File.open("mypdf.pdf")
IO.popen("#{file} | convert -resize 700x700 pdf:-[0] png:-") {|f|
do_something_with_this_file}
This obviously doesn't work but I hope illustrates what I'm wanting to
acheive - namely to pass 'file' to convert it to a png which is read
back into ruby and uploaded to my file repository on S3.
By the way, this IS for a rails application, but it seems basically like
a pure ruby question to me.
Regards
Adam
I'm wanting to create thumbnails of pdfs in png format and send them off
to be saved. I've come up with this so far:
IO.popen("curl #{some_uri} | convert -resize 700x700 pdf:-[0]
png:-") {|f| do_something_with_this_file}
Which works a treat. (In case you didn't know, convert is a command line
tool for ImageMagick).
What I'd really like to do though is pass on a File object to convert:
file = File.open("mypdf.pdf")
IO.popen("#{file} | convert -resize 700x700 pdf:-[0] png:-") {|f|
do_something_with_this_file}
This obviously doesn't work but I hope illustrates what I'm wanting to
acheive - namely to pass 'file' to convert it to a png which is read
back into ruby and uploaded to my file repository on S3.
By the way, this IS for a rails application, but it seems basically like
a pure ruby question to me.
Regards
Adam