Re: [Zope-dev] Re: Transaction support on MySQL
Unless you want to generate PDF or Postscript files on the fly, you are *not* going to get what you want from a browser-based application, regardless of the server. Neither Zope nor any other Web App can control how your browser will print an HTML page (AFAIK).
There is a PDF package for Perl, but I don't know of any for Python. If there are, then you can relatively easily generate PDF on the fly.
There is an excelent library at:
that comes with a Python interface. It has a pricetag for commercial use however.
I like to first thank all of you for your suggestions. But I still can't quite figure out how PDF can solve my problem. The first problem I am facing is printing reports to pre printed forms loaded in dot matrix printers. The program has to drive the printer to print the info at the right spot on the form. The second problem is how to print barcode(Code39 symbology) on some documents. The barcode encodes the document number. I have found a barcode class written in Java. Is there a way to use Java class within Zope? Regards, Ping
Ping Lau wrote:
I like to first thank all of you for your suggestions. But I still can't quite figure out how PDF can solve my problem. The first problem I am facing is printing reports to pre printed forms loaded in dot matrix printers. The program has to drive the printer to print the info at the right spot on the form. The second problem is how to print barcode(Code39 symbology) on some documents. The barcode encodes the document number. I have found a barcode class written in Java. Is there a way to use Java class within Zope?
The reason we've been talking about PDF is that PDF files are explicitly designed to reproduce pages exactly as you specify, with everything positioned just so. Unless you use Acrobat Reader or some similar technology, you are going to find it very difficult to get your data to line up right on your pre-printed forms. HTML (the format your browser understands, and which Zope usually supplies) was never meant for precise positioning of page elements -- quite the opposite, in fact. This is a much larger problem than generating the barcodes, which will depend on the document format you choose for printing. Is there some reason why Zope is an especially good fit for your application?
From what you've mentioned so far, I'd suggest sticking to Delphi (or learning Python, but that's another story :-)
At 10:05 PM 9/27/99 -0500, Evan Simpson wrote:
Ping Lau wrote:
I like to first thank all of you for your suggestions. But I still can't quite figure out how PDF can solve my problem. The first problem I am facing is printing reports to pre printed forms loaded in dot matrix printers. The program has to drive the printer to print the info at the right spot on the form. The second problem is how to print barcode(Code39 symbology) on some documents. The barcode encodes the document number. I have found a barcode class written in Java. Is there a way to use Java class within Zope?
The reason we've been talking about PDF is that PDF files are explicitly designed to reproduce pages exactly as you specify, with everything positioned just so.
Perhaps I'm missing the point but, for the barcodes, why not just generate GIFs ? Then you could link them into webpages or wherever. Faster, no plugins, leaves you open to choose another format for the actual reports. PIL is at www.pythonware.com (or go get Boutell's gd-lib if you're that way inclined)
Unless you use Acrobat Reader or some similar technology, you are going to find it very difficult to get your data to line up right on your pre-printed forms. HTML (the format your browser understands, and which Zope usually supplies) was never meant for precise positioning of page elements -- quite the opposite, in fact. This is a much larger problem than generating the barcodes, which will depend on the document format you choose for printing.
As for reports, PDF is good for all of the reasons outlined by Evan. However, with MSIE 4+ and absolute positioning, you CAN generate a report with layout as precise and as good as any PDF document - easier and quicker to do too (I'm assuming your html and css are ok). Stylesheets and the MSIE Client SDK are your friends. For the reports, I'm assuming you control the end browser and this is not for public access where some mong will be using Netscape 1.x chas
On Tue, 28 Sep 1999, chas wrote:
Perhaps I'm missing the point but, for the barcodes, why not just generate GIFs ? Then you could link them into webpages or wherever. Faster, no plugins, leaves you open to choose another format for the actual reports. Well, the problem with GIFs is, that you cannot control which page layout the browser will use to print the image. Additionally, for a modern 24pin matrix printer, the resolution would have to be 360x180 dpi or so. (That's another thing you cannot express with an image/html: that the resolution of the image is X dpi, not some browser default.)
As for reports, PDF is good for all of the reasons outlined by Evan. However, with MSIE 4+ and absolute positioning, you CAN generate a report with layout as precise and as good as any PDF document - easier and quicker to do too (I'm assuming your html and css are ok). Stylesheets and the MSIE Client SDK are your friends. For the reports, I'm assuming you control the end browser and this is not for public access where some mong will be using Netscape 1.x Still doesn't solve the problem: For real form printing with dot matrix printers one usually want to print ASCII and not bitmaps.
Andreas -- Andreas Kostyrka | andreas@mtg.co.at phone: +43/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
On Tue, Sep 28, 1999 at 09:38:51AM +0200, Andreas Kostyrka wrote:
On Tue, 28 Sep 1999, chas wrote:
Perhaps I'm missing the point but, for the barcodes, why not just generate GIFs ? Then you could link them into webpages or wherever. Faster, no plugins, leaves you open to choose another format for the actual reports. Well, the problem with GIFs is, that you cannot control which page layout the browser will use to print the image.
Precisely! That's exactly they point people have been trying to make. If you need to generate reports out of an app in Zope, you probably shouldn't be shoehorning them through the browser. You more than likely want to generate either raw postscript, or a command file for an intermediate processor (ie: report writer) and hand that your data. Then, let that get shipped out to a printer somehow (even if that "somehow" is to put the proper MIME type on it and ship it out to the browser. This is a good architectural question, Coolsters: what _is_ the report writing approach that's recommended here?
Still doesn't solve the problem: For real form printing with dot matrix printers one usually want to print ASCII and not bitmaps.
Stipulated. If all you want to print is ASCII, it's even easier. Your only problem is the barcodes. Do your printers have a Code39 font, either native, or on a card? If you can, you _always_ wanna do barcodes in hardware. Cheers, -- jra -- Jay R. Ashworth jra@baylink.com Member of the Technical Staff Buy copies of The New Hackers Dictionary. The Suncoast Freenet Give them to all your friends. Tampa Bay, Florida http://www.ccil.org/jargon/ +1 813 790 7592
At 17:27 28/09/99 , Ping Lau wrote:
Unless you want to generate PDF or Postscript files on the fly, you are *not* going to get what you want from a browser-based application, regardless of the server. Neither Zope nor any other Web App can control how your browser will print an HTML page (AFAIK).
There is a PDF package for Perl, but I don't know of any for Python. If there are, then you can relatively easily generate PDF on the fly.
There is an excelent library at:
that comes with a Python interface. It has a pricetag for commercial use however.
I like to first thank all of you for your suggestions. But I still can't quite figure out how PDF can solve my problem. The first problem I am facing is printing reports to pre printed forms loaded in dot matrix printers. The program has to drive the printer to print the info at the right spot on the form. The second problem is how to print barcode(Code39 symbology) on some documents. The barcode encodes the document number. I have found a barcode class written in Java. Is there a way to use Java class within Zope?
With PDF you can position very precisely, and consistently across platforms. With it you can generate a printable document that would fit perfectly into your pre-printed form. You wll have to experiment a bit with the fonts and a dot-matrix printer though, to see what works best. As for barcodes: They are only lines of different widths. If you have the source of that Java class, you could reimplement it in Python, and, if they are part of the documents you are going to print with PDF, integrate that with your generated document. Both PDF libraries mentioned allow you to directly draw lines of a specified width, and import a GIF. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
On Tue, 28 Sep 1999, Martijn Pieters wrote:
At 17:27 28/09/99 , Ping Lau wrote:
I like to first thank all of you for your suggestions. But I still can't quite figure out how PDF can solve my problem. The first problem I am facing is printing reports to pre printed forms loaded in dot matrix printers. The program has to drive the printer to print the info at the Well, this sound as if you want to print serverside: queue it with lpr at the right terminal ;) With dot matrix printers, you probably do not want to use graphical (postscript/pdf) mode, just print via the standard Ascii interface. (We do have such Unix applications, that do have an internal python MT2033 printer driver. Actually, it's general if you tell this thing how large the character cell is in the default font of the printer.)
With PDF you can position very precisely, and consistently across platforms. With it you can generate a printable document that would fit perfectly into your pre-printed form. You wll have to experiment a bit with the fonts and a dot-matrix printer though, to see what works best. Well, this might work for seldom used forms. dot matrix + bitmap printing == really slow.
As for barcodes: They are only lines of different widths. If you have the source of that Java class, you could reimplement it in Python, and, if they are part of the documents you are going to print with PDF, integrate that with your generated document. Both PDF libraries mentioned allow you to directly draw lines of a specified width, and import a GIF. Well, with python, there is the following (sick!) alternative: DISPLAY=vfbX:somenum import Tkinter Tkinter.Canvas -> can print postscript. ghostscript -> can convert postscript to pdf.
But then, at least generating ps is not the difficult, if you stick to text and lines. (Actually, text gets irritating if you want to include non Ascii(7bit) characters. Well, one gets quickly your own boilerplate code.) Andreas -- Andreas Kostyrka | andreas@mtg.co.at phone: +43/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
Andreas Kostyrka wrote:
On Tue, 28 Sep 1999, Martijn Pieters wrote:
At 17:27 28/09/99 , Ping Lau wrote:
I like to first thank all of you for your suggestions. But I still can't quite figure out how PDF can solve my problem. The first problem I am facing is printing reports to pre printed forms loaded in dot matrix printers. The program has to drive the printer to print the info at the Well, this sound as if you want to print serverside: queue it with lpr at the right terminal ;)
Or if it is on client side, one can always try something creative, like POSTing a form to LPT1: .At least the older browsers used to allow things like these ;) ------------ Hannu
On Tue, 28 Sep 1999, Hannu Krosing wrote:
Or if it is on client side, one can always try something creative, like POSTing a form to LPT1: .At least the older browsers used to allow things like these ;) Well, that's creative ;) Still, it's probably more stable to print via lpd/smbclient ;)
Andreas -- Andreas Kostyrka | andreas@mtg.co.at phone: +43/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
Martijn Pieters wrote:
As for barcodes: They are only lines of different widths. If you have the source of that Java class, you could reimplement it in Python, and, if they are part of the documents you are going to print with PDF, integrate that with your generated document. Both PDF libraries mentioned allow you to directly draw lines of a specified width, and import a GIF.
Recently there was an article in http://slashdot.org about some nice college where students were forced to wear an ID sign with their Social Security Number as barcode (and a Pepsi logo ;). The school authorities claimed that it was OK as the number was "encoded". It included a link to the description of the barcode format which seemed quite easy both to read and to implement, even as alternating black and white gif stripes. -------------- Hannu
participants (7)
-
Andreas Kostyrka -
chas -
Evan Simpson -
Hannu Krosing -
Jay R. Ashworth -
Martijn Pieters -
Ping Lau