Printing prawn generated pdf

2019-05-29 04:57发布

Using prawn gem for ruby-on-rails webpage, is it possible to send print request to printer device to print pdf page I've generated using prawn?

1条回答
forever°为你锁心
2楼-- · 2019-05-29 05:42

Looks like you would want to use prawn-print.

# Open print dialog, but don't autoprint.
pdf = Prawn::Document.new
pdf.text "I installed Adobe Reader and all I got was this lousy printout."
pdf.print

# Autoprint it on the default printer, when opened.
pdf = Prawn::Document.new
pdf.text "Help! I am trapped in a PDF factory!"
pdf.autoprint

# Autoprint it on a printer where the name includes "LaserJet".
pdf = Prawn::Document.new
pdf.text "Help! I am trapped in a PDF factory!"
pdf.autoprint "LaserJet"
查看更多
登录 后发表回答