If you are looking for a working PDF generator visit ActionMarket/PdfAction. |
PdfLetter
Produces a letter in html and pdf.
As I am new to wiki(and MoinMoin), this is my test for learning MoinMoin. If you read the code and say to yourself what is this guy doing, please point me in the right direction. I will put it up at ProcessorMarket when I think its usable.
I didn't try it out yet, but the code looks quite ok. A few small issues:
standard indentation in python / MoinMoin is 4 blanks (no TABs)
split=line.split('=') if split>-1 and split[0].strip() in keys:
Fixed to
split=line.split('=') if len(split)>1 and split[0].strip() in keys:
That doesn't work.
Fixed the indention and the bug, Thanks - FredrikBjornsson
I made the script running under Python 2.3 and MoinMoin 1.3 with two minor changes
attDir=AttachFile.getAttachDir(request,formatter.page.page_name,create=1) added request in the function call
open(attDir+'report.pdf','wb') added b to do a binary write
-- Robert Groenewegen 2005-01-06 13:11:18
Install
you need reportlab from http://www.reportlab.org/
- you need Attachment enabled in your moin_config.py
Example
{ { {#!PdfLetter TO = Foo Fooson Foostreet 1 1234 Foocity FROM = Fredrik Fredrikson Fredriksstreet 1 4321 Fredrikscity DATE = 2004-08-10 SUBJECT = About your foo and the other thing BODY = Blaha and blaha did some blaha with blaha.Blaha and blaha did some blaha with blaha.Blaha and blaha did some blaha with blaha. Blaha and blaha did some blaha with blaha. Blaha and blaha did some blaha with blaha.Blaha and blaha did some blaha with blaha.Blaha and blaha did some blaha with blaha.Blaha and blaha did some blaha with blaha. SIGNATURE = Fredrik Fredrikson } } }
Remove the spaces in { { { and } } }
Result
You will see this
and clicking the Get Pdf link will open the pdf in a new window.
Source
Changes
MoinMoin - PdfLetter @license: GNU GPL @copyright: 2004 by Fredrik Björnsson <info@cleosan.com> 2004-10-07 - Started 2004-10-07 - Fixed indention to 4 spaces and a small bug
Discussion
This is my first plugin, so be gentle FredrikBjornsson