Tracy R Reed wrote:

We need to be able to produce custom forms such as invoices, packing lists, receipts, etc. We have been doing it with LaTeX but there are two problems with it:

1. The first is technical. LaTex is good at books and articles etc. but it is not so great at making forms. For example it considers each page individually so columns will not necessarily line up across pages depending on how wide the biggest thing in the column is etc. Its job is really as a typesetting program where the author provides the content and LaTeX generates the presentation. We need something that will let us specify both the content and the presentation.

2. Only a couple people here know LaTeX.

We would like to be able to have our web design staff create our forms for us. We can make great looking forms on the screen exactly how we want them using XHTML/CSS. And if we hit print it turns out great. The problem is how can we render XHTML/CSS to postscript in an automated fashion? We have to be able to do it from a shell script or perl or python. The first thing that always comes to mind is somehow scripting Mozilla but I am not aware of a way to script it in this way much less do it on a headless server. Others have suggested OpenOffice but it would have the same problem as mozilla. And if it is possible nobody seems to know anyone who has actually done it.

Ideas?

Scripting Mozilla/Firefox means writing Javascript. You would create a URL that consists of the reference to the file you need to process and then run it like

mozilla file:///var/www/html/some-other-stuff/myfile.html

To make this work on a headless box you could use the Xvfb (X Virtual Frame Buffer driver, xorg-x11-server-Xvfb in the latest version of Fedora). This allows you to run X applications without having a video card.

You may need to capture the PID of the mozilla instance to send it a HUP to make it shut down when you are done. I haven't done any experiments with this yet to check the exact behavior. I also don't know how it would handle multiple instantiations.

Print to a Postscript printer driver but send the output to a file. This is fairly straightforward in Linux and there are generic printer drivers available for MS Windows.

For example, I have HP Laserjet 4ML and Mozilla on Linux uses the Postscript printer driver to send print jobs to the printer. However, I have the option to redirect the output to a file instead of the printer.

If you want to use Mozilla/Firefox as an application builder tool I recommend "Rapid Application Development with Mozilla" by Nigel McFarlane, Prentice-Hall, Bruce Perens Open Source Series. I have a copy you can borrow. Be warned that at times it is fairly dense (or maybe I am) and that if you need to do some extension work you'll need a C++ programmer. But from the sound of it I think you can get away with just some simple programming. The real problem will be making the security part work because you will be messing with local files.

Gus


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to