ruby - Prawn : Print existing PDF -
ruby - Prawn : Print existing PDF -
i have model called mag number , pdf file.
i seek access url /magazine/:number.pdf
in controller :
@magazine = magazine.find_by_number params[:number]
but how can display pdf ?
thanks
in controller:
respond_to |format| ... format.pdf pdf = prawn::document.new # don't know how document stored send_data pdf.render, filename: 'report.pdf', type: 'application/pdf' end end
don't forget register mimetype in initializer:
mime::type.register "application/pdf", :pdf
ruby prawn
Comments
Post a Comment