Printing in Ruby

  • Thread starter Sabyasachi Mustafi
  • Start date
S

Sabyasachi Mustafi

I made a simple thing in ruby for printing to the printer.
Make the output in a file and then print it.

pp=File.open('C:\test.doc','w')
pp.print "hello print"
pp.close
system('D:\Program Files\Microsoft Office\Office10\Winword
"C:\test.doc"')

It works fine in Windows or Linux with the system.
But I don't know if there is any other simple solution. Actually I
need to make a report, so there are some formatted text, also
different sizes of papers etc. Any other solution for this?

Regards,
Sabyasachi Mustafi

___________________________________________________
Law meets Electronics; Veena Weds Sanjay.
Rediff Matchmaker strikes another interesting match !!
Visit http://rediff.com/matchmaker?1
 
A

Aredridel

--=-Kg5FcLkNi0g5/RIE1F0x
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

[clip]
It works fine in Windows or Linux with the system.
But I don't know if there is any other simple solution. Actually I=20
need to make a report, so there are some formatted text, also=20
different sizes of papers etc. Any other solution for this?

I think you're probably best off doing what the unix crowds have always
done: make postscript. After that, you can post-process with free tools
into PDF files, or you can make it into (non-postscript) printer form
with Ghostscript, or you can print it directly with a postscript
printer.

It's not super-simple, but for a surprising number of tasks, pretty easy
-- and Ruby can abstract away a surprising amount, if you write the code
to do it. Anyone else have classes for dealing with Postscript to
share? Mine are as yet theoretical.

Ari

--=-Kg5FcLkNi0g5/RIE1F0x
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQA/V2bitP09exA3hooRAphlAJ95+MFAP2t/7Dz48Ls8pZts3RQEOACfbBbv
7rGVjGGmWqg2eoSkRhOllSU=
=tIE1
-----END PGP SIGNATURE-----
0
--=-Kg5FcLkNi0g5/RIE1F0x--
 
S

Simon Strandgaard

I made a simple thing in ruby for printing to the printer.
Make the output in a file and then print it.

pp=File.open('C:\test.doc','w')
pp.print "hello print"
pp.close
system('D:\Program Files\Microsoft Office\Office10\Winword
"C:\test.doc"')

It works fine in Windows or Linux with the system.
But I don't know if there is any other simple solution. Actually I
need to make a report, so there are some formatted text, also
different sizes of papers etc. Any other solution for this?

DocBook-xml is a nice open-standard format. It can output a huge range
of formats (html, pdf, ps, man, rtf, xhtml, winhelp, others?).
There is also many free tools for processing docbook.

<section><title>Hello World</title>
<para>This is DocBook-xml.</para>
</section>

Quite nice, I love it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top