Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= form_tag preview_path(@document, format: :pdf), method: :get do %>
- <%= select_tag "id", options_from_collection_for_select(@templates, "id", "code"), include_blank: true %>
- <%= submit_tag "Download" %>
- <% end %>
- respond_to do |format|
- format.pdf do
- render pdf: "Labels " + @template.code,
- template: "documents/preview.pdf.erb",
- layout: 'layouts/pdf.html.erb',
- disposition: 'attachment', /* DIRECT DOWNLOAD */
- locals: {:document => @document},
- show_as_html: false,
- margin: { top: @template.top_margin, # default 10 (mm)
- bottom: @template.bottom_margin,
- left: @template.left_margin,
- right: @template.right_margin },
- paper_size: @template.paper_size
- end
- end
- end
Add Comment
Please, Sign In to add comment