[reportlab-users] [ANN] PyCanvas v0.2

Jerome Alet reportlab-users@reportlab.com
Mon, 30 Sep 2002 12:05:19 +0200


Hi,

I'm pleased to announce the availability of PyCanvas v0.2

PyCanvas is a canvas.Canvas like class which works similarly
to the original one included in reportlab/pdfgen/canvas.py,
but adds a __str__ method which returns the Python source code
which you can save and run again to produce the same results 
as your original program, when calling the str() method on
your instance of PyCanvas.Canvas.

I don't know if this is useful or not, but at least it seems
to work better and better.

This new version doesn't output anything for nested calls, since the 
top-level call will call the sub-levels' ones automatically. This 
produces more easily readable programs and take care of possible
unwanted problems due to methods called twice.

Here's how it works (how to run the test program) :

----
  The tests subdirectory includes a slightly modified
version of my GPLed software ScanErrLog which produces
reports based on Apache error_log files. It also contains
a fake error_log file named errlog.

ScanErrLog uses platypus with tables so the test is somewhat complex,
and if it works then chances are that it will work with
most of your programs.

  Launching the test program :
  
  $ cd tests
  $ python scanerrlog.py -f pdf -o out-orig.pdf errlog >new.py
  
  Then edit the new.py file and replace the 
  
    <cStringIO.StringIO object at ...>
    
  on the canvas.Canvas() line by "out-new.pdf"
  
  Then :
  
  $ python new.py
  
  $ acroread out-orig.pdf out-new.pdf
  
  Then compare the two files.
  
  Then : be happy !
----

PDFTextObjects and PDFPathObjects should work fine and cleanly now.

License : ReportLab's license, but you can't redistribute
the test program (see README).

Download it from : 

    http://www.librelogiciel.com/software/PyCanvas-0.2.tar.gz

Any chance for this to be included in RL ?

Any comment or bug report is VERY welcome.

Thanks in advance.

Jerome Alet