Printing a file to a printer in Ruby

前端 未结 4 695
清酒与你
清酒与你 2020-12-16 06:29

I need help with sending a formatted text to a printer using Ruby on Ruby on Rails OR sending a pdf file to a printer from Ruby program. I can write the code to create a pdf

4条回答
  •  孤城傲影
    2020-12-16 07:24

    Here is a solution in Windows environement : Foxit ! http://www.foxitsoftware.com/pdf/reader/

    You can call foxit.exe (standalone executable) to silently print a PDF in background.

    Syntax : foxit.exe /t "your file.pdf" "The Printer Name"

    shell = WIN32OLE.new('Shell.Application')

    shell.ShellExecute("foxit.exe","/t \"#{filename}\" \"#{printer}\"")

提交回复
热议问题