I use the module rst2pdf (which uses reportlab) and the following
button script (use Toolbar Manager plugin).  The last line
automatically opens the pdf file in a reader (variables need to be
set).

### begin code
@
@btn bg = LightYellow1
@btn tooltip = convert rst node to pdf file and open
@c

import os, subprocess

g.redirectStdout(); g.redirectStderr()

c.k.simulateCommand('write-restructured-text')
_cnode = c.currentPosition()
_prochead = _cnode.headString().split()[1]
_thispath = os.path.dirname(c.fileName())+"/" +_prochead
_runstring = _rst2pdf + " "+ _localpath + " -o " + _localpath+".pdf"
os.system(_runstring)
_pid = subprocess.Popen([_pdfreader_path,_thispath+".pdf"]).pid

### end code

On Aug 17, 8:29 pm, drmikecrowe <[email protected]> wrote:
> Hi folks,
>
> Two things:
>
> 1)  How can we generate PDF output?  rst -> html is working fine, but
> when I do an @rst FileName.pdf, I get this:
> Traceback (most recent call last):
>   File "C:\Users\mcrowe\Programming\leo\leo-editor\leo\plugins
> \rst3.py", line 1267, in writeSpecialTree
>     output = self.writeToDocutils(self.source)
>   File "C:\Users\mcrowe\Programming\leo\leo-editor\leo\plugins
> \rst3.py", line 1357, in writeToDocutils
>     settings_overrides=overrides)
>   File "C:\Python26\lib\site-packages\docutils-0.5-py2.6.egg\docutils
> \core.py", line 399, in publish_string
>     enable_exit_status=enable_exit_status)
>   File "C:\Python26\lib\site-packages\docutils-0.5-py2.6.egg\docutils
> \core.py", line 609, in publish_programmatically
>     pub.set_components(reader_name, parser_name, writer_name)
>   File "C:\Python26\lib\site-packages\docutils-0.5-py2.6.egg\docutils
> \core.py", line 98, in set_components
>     self.set_writer(writer_name)
>   File "C:\Python26\lib\site-packages\docutils-0.5-py2.6.egg\docutils
> \core.py", line 87, in set_writer
>     writer_class = writers.get_writer_class(writer_name)
>   File "C:\Python26\lib\site-packages\docutils-0.5-py2.6.egg\docutils
> \writers\__init__.py", line 133, in get_writer_class
>     return module.Writer
> AttributeError: 'module' object has no attribute 'Writer'
>
> 2)  Has this been discussed?  I entered "pdf" in the google groups
> text box for this mailing list, can came up pretty dry.  Is the google
> search broken (gasp)?
>
> Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to