Splitting PDF to png

I am using paperclip to download pdf. Once the file is uploaded, I need to split each page into png. This is a team, I think I need to use

convert -size 640x300 fileName.pdf slide.png

Now, if I run this command from the terminal, it works fine, but I need to get each slide name so that I can add it to the model.

What is the best way to achieve this?

+3
source share
2 answers

use `command` to execute system codes (` -quotes)

`convert -size 640x300 fileName.pdf slide.png`

+2
source

You should be able to do this conversion for you at boot time, for example:

has_attached_file :pdfupload, :styles => { :pinged => ["640x300", :png] }

PNG :

<%= image_tag @mymodel.pdfupload.url(:pinged) %>

(, .)

+4

Source: https://habr.com/ru/post/1740057/


All Articles