Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. document = Nokogiri::XML(File.read(Rails.root.to_s+'/lib/label.xml'))
  2. template = Nokogiri::XSLT(File.open(Rails.root.to_s+'/lib/xsl_which_imports_more_xsl.xsl','rb'))
  3. html_document = template.transform(document)
  4.  
  5. pdf = WickedPdf.new.pdf_from_string(html_document)
  6.  
  7. save_path = Rails.root.join('public','filename.pdf')
  8. File.open(save_path, 'wb') do |file|
  9. file << pdf
  10. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement