I’m a Ruby newbie, but I’ve decided to write a commercial application
using Ruby. This application needs the capability to print on a
pre-printed form. Can Ruby do this?
I’ve been writing it in Lotus Notes, but I will need to spend a
considerable amount of money for software that will standardize the
print, regardless of the printer. Writing it in Ruby, using FXRuby and
FreeRIDE, will give me some great experience with Ruby.
I don’t want to get started, however, if the consensus is that Ruby
can’t handle my printing needs.
This might not appeal unless you have some TeX experience, but I’ve had
a lot of luck generating fairly complex financial forms (multi-page
invoices, statements, and so on) using Ruby. The approach I take is to
have the Ruby code generate all the values, and then call a templating
library (actually the one I wrote for RDoc) to substitute those values
into a LaTeX document. I then format this, and present the results to
the end user as PDFs. I write a fairly simple style sheet for each
document type, and the templates invoke macros in these style sheets.
Using LaTeX (TeX) gives me precise control over positioning of the
fields on the paper.
Cheers
Dave
···
On Fri, 2002-12-27 at 15:11, John Reed wrote:
I’m a Ruby newbie, but I’ve decided to write a commercial application
using Ruby. This application needs the capability to print on a
pre-printed form. Can Ruby do this?
I’ve been writing it in Lotus Notes, but I will need to spend a
considerable amount of money for software that will standardize the
print, regardless of the printer. Writing it in Ruby, using FXRuby and
FreeRIDE, will give me some great experience with Ruby.
This might not appeal unless you have some TeX experience, but I’ve had
a lot of luck generating fairly complex financial forms (multi-page
invoices, statements, and so on) using Ruby.
Is this code available anywhere for public consumption ?
The approach I take is to have the Ruby code generate all the values,
and then call a templating
library (actually the one I wrote for RDoc) to substitute those values
into a LaTeX document. I then format this, and present the results to
the end user as PDFs.
Is conversion from LaTeX to PDF fairly easy and multi-platform ?
I write a fairly simple style sheet for each document type, and the
templates invoke macros in these style sheets.
Using LaTeX (TeX) gives me precise control over positioning of the
fields on the paper.
Is conversion from LaTeX to PDF fairly easy and multi-platform ?
use pdflatex – that saves you some problems with fonts.
Alternatively on linux use:
dvips and then ps2pdf
These packages rely on ghostscript – I think.
LaTeX takes some time to get used to, but
once you know it, you might not want to go
back.
Good luck,
-A
···
Armin Roehrl, http://www.approximity.com
Training, Development and Mentoring
OOP, XP, Java, Ruby, Smalltalk, Datamining, Parallel computing, Webservices
This might not appeal unless you have some TeX experience, but I’ve had
a lot of luck generating fairly complex financial forms (multi-page
invoices, statements, and so on) using Ruby.
Is this code available anywhere for public consumption ?
The templating code is based on the one in RDoc. In this particular
application, I use the same templating code to do web pages, XML,
e-mail, and LaTeX.
I could post it separately somewhere if folks want.
Is conversion from LaTeX to PDF fairly easy and multi-platform ?
I use pdflatex under Linux – I’ve never tried it under Windows, but I
suspect there’s something similar. In my experience, pdflatex produces
better output than using straight LaTeX and then converting the dvi or
postscript to PDFs.
Is conversion from LaTeX to PDF fairly easy and multi-platform ?
Yes, the easiest way is to use pdflatex which outputs PDF files
instead of the usual DVI files
I write a fairly simple style sheet for each document type, and the
templates invoke macros in these style sheets.
Using LaTeX (TeX) gives me precise control over positioning of the
fields on the paper.
Awesome !
It’s even easier now that Ruby (1.8) includes ‘erb.rb’ templating
library.
This might not appeal unless you have some TeX experience, but I’ve had
a lot of luck generating fairly complex financial forms (multi-page
invoices, statements, and so on) using Ruby.
Is this code available anywhere for public consumption ?
The templating code is based on the one in RDoc. In this particular
application, I use the same templating code to do web pages, XML,
e-mail, and LaTeX.
I could post it separately somewhere if folks want.
Is conversion from LaTeX to PDF fairly easy and multi-platform ?
use pdflatex – that saves you some problems with fonts.
Alternatively on linux use:
dvips and then ps2pdf
These packages rely on ghostscript – I think.
LaTeX takes some time to get used to, but
once you know it, you might not want to go
back.
Good luck,
-A
Armin Roehrl, http://www.approximity.com
Training, Development and Mentoring
OOP, XP, Java, Ruby, Smalltalk, Datamining, Parallel computing,
Webservices
The templating code is based on the one in RDoc. In this particular
application, I use the same templating code to do web pages, XML,
e-mail, and LaTeX.
I could post it separately somewhere if folks want.
I was looking around for a decent template system, and RDoc’s fit the
bill for me, almost. I had some perfectly good objects lying around
with perfectly good methods on them, and didn’t want to go through the
extra (tedious) step of converting them all to Hash/Array combinations,
so I did this to (a prior version of) RDoc’s template system:
NOTES:
My version is faster, mainly because I don’t use an Array to build
up a temporary object, but you can’t write onto anything but a string.
I haven’t bothered to attempt to fix this yet (it hasn’t been a
problem for me).
My version has slightly different syntax for iteration (FOREACH/ENDEACH),
due to the addition of WITH/ENDWITH.
The templating code is based on the one in RDoc. In this particular
application, I use the same templating code to do web pages, XML,
e-mail, and LaTeX.
I could post it separately somewhere if folks want.
The templating code is based on the one in RDoc. In this particular
application, I use the same templating code to do web pages, XML,
e-mail, and LaTeX.
I could post it separately somewhere if folks want.
you can use RDoc for general purpose templating? i thought it was only for
documenting Ruby code. (I checked RDoc web page but didn’t see any reference
to this type of use.)
what do the templates look like in doing this?
currently i use eRuby. I would have liked to use Amrita, but it seems the
attribute templating is still considered experimental.
i’m curious as to the relative performace comparisons between the various
templating options. anyone have any experience to draw upon for this?
-transami
···
On Saturday 28 December 2002 12:22 am, Eric Hodel wrote:
I was looking around for a decent template system, and RDoc’s fit the
bill for me, almost. I had some perfectly good objects lying around
with perfectly good methods on them, and didn’t want to go through the
extra (tedious) step of converting them all to Hash/Array combinations,
so I did this to (a prior version of) RDoc’s template system:
currently i use eRuby. I would have liked to use Amrita, but it seems the
attribute templating is still considered experimental.
If you’re talking about attribute expansion; yes it is still ‘experimental’
(as of 1.0), but I speak from experience when I say it is definitely working.
I use amrita for the vast majority of my web projects (in the past I used
eruby) and attribute expansion has never been a problem. I’m guessing it is
only considered “experimental” due to the fact its implementation may be
changed sometime in the future (I defer to Nakajima-san for further details
and/or clarification).
i’m curious as to the relative performace comparisons between the various
templating options. anyone have any experience to draw upon for this?
-transami
Eruby/erb is decidedly faster than amrita due to the way data is applied to
the templates (amrita actually understands the template ‘context’ when the
data is applied, enabling it to apply sequences repetatively, etc-- this
“smart” templating comes at an obvious perfomance cost)-- other templating
libraries blindly insert data, IIRC. Amrita is, of course, an excellent
choice for static page creation, but I would caution using it in larger,
heavy bandwidth projects where templates would be expanded dynamically.
Speed optimization is definitely one of the chief areas of concern in Amrita
development; I’m sure the situation will become more amenable in the future
as the project matures.
Hope this helps,
~ Bruce
···
On Saturday 28 December 2002 02:31 am, Tom Sawyer wrote:
I was looking around for a decent template system, and RDoc’s fit the
bill for me, almost. I had some perfectly good objects lying around
with perfectly good methods on them, and didn’t want to go through the
extra (tedious) step of converting them all to Hash/Array combinations,
so I did this to (a prior version of) RDoc’s template system:
you can use RDoc for general purpose templating? i thought it was only for
documenting Ruby code. (I checked RDoc web page but didn’t see any reference
to this type of use.)
Well, no, but I attended RubyConf, and Dave hinted at such a thing in
RDoc, so I looked in there, found it, stole it, and hacked it up
what do the templates look like in doing this?
Using my hacked version, you do something like this:
currently i use eRuby. I would have liked to use Amrita, but it seems the
attribute templating is still considered experimental.
eRuby is very slow, as it eval’s a tempfile to generate the page.
i’m curious as to the relative performace comparisons between the various
templating options. anyone have any experience to draw upon for this?
Well, anything in pure ruby is going to be slower than a pure C version.
How much faster or slower will be dependent upon features offered.
RDoc’s and mine are pretty much brain-dead simple, and I hacked mine to
up the speed (I took out a call to Array#join that really sucked down
performance, and eliminated RegExp as much as convenient, in favor of
String#).
currently i use eRuby. I would have liked to use Amrita, but it seems the
attribute templating is still considered experimental.
If you’re talking about attribute expansion; yes it is still ‘experimental’
(as of 1.0), but I speak from experience when I say it is definitely working.
I use amrita for the vast majority of my web projects (in the past I used
eruby) and attribute expansion has never been a problem. I’m guessing it is
only considered “experimental” due to the fact its implementation may be
changed sometime in the future (I defer to Nakajima-san for further details
and/or clarification).
I agree with you. I think “attribute expansion” is working well .
amrita’s experimental features are experimental partly because they
are not tested enough. But main reason is it’s easy to add a feature
but difficult to remove one once it was released and get users.
i’m curious as to the relative performace comparisons between the various
templating options. anyone have any experience to draw upon for this?
-transami
Eruby/erb is decidedly faster than amrita due to the way data is applied to
the templates (amrita actually understands the template ‘context’ when the
data is applied, enabling it to apply sequences repetatively, etc-- this
“smart” templating comes at an obvious perfomance cost)-- other templating
libraries blindly insert data, IIRC. Amrita is, of course, an excellent
choice for static page creation, but I would caution using it in larger,
heavy bandwidth projects where templates would be expanded dynamically.
Speed optimization is definitely one of the chief areas of concern in Amrita
development; I’m sure the situation will become more amenable in the future
as the project matures.
Recently a good idea of new compiler architecture came to me . I think
the new version of amrita will produce a Ruby code as fast as a plain
Ruby. And it will also generate a C code (extention module) that runs
faster than a Ruby equivalent.
···
At Sat, 28 Dec 2002 17:16:45 +0900, Bruce Williams wrote:
On Saturday 28 December 2002 02:31 am, Tom Sawyer wrote: