Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about rst2pdf (old posts, page 8)

Having a little fun with poppler, PyQt and rst2pdf

In­spired by a post by An­dré Roberge I want­ed to see if rst2pdf was too slow to be used for re­al-­time pre­views in a re­struc­tured text ed­i­tor.

It would al­so be very use­ful, for ex­am­ple, as a way to test stylesheet changes, mak­ing rst2pdf much more use­ful in gen­er­al.

And af­ter a cou­ple of hours of gen­tle hack­ing, you know... it does­n't suck at all. I im­ple­ment­ed the (still very prim­i­tive) PDF view­er us­ing a python/pop­pler/Qt bind­ing I found via google, the UI is PyQt.

Here's the video:

A note: the video was record­ed us­ing qt-record­my­desk­top and that pro­gram is awe­some. It was triv­ial to do.

I ex­pect this will not be good enough when long doc­u­ments are pro­cessed, but the rst2pdf man­u­al (about 25 pages) ren­ders in 5 sec­ond­s.

Cheatsheets: RST and Python

I nev­er re­mem­ber how to do foot­notes right us­ing Re­Struc­tured Tex­t.

If that, or some­thing sim­i­lar, hap­pens to you, get my rst cheat­sheet and print it, it's a two-sid­ed A4 page.

This is an ear­ly ver­sion, the left­-­hand col­umns need lots of love.

Al­so, you may want to take a look at this one-­page python cheat­sheet, too.

Both are cre­at­ed us­ing re­struc­tured text and rst2pdf, and li­censed un­der Cre­ative Com­mon­s.

I would love to see trans­la­tions to oth­er lan­guages. If you want to help, con­tact me!

Preparing a rst2pdf release for next week

Since this is the first post that ap­pears in Plan­et Python, a small in­tro is in or­der.

Hi, my name is Rober­to Alsi­na, I am a for­mer KDE de­vel­op­er, am­a­teur pro­gram­mer [1] , python fan.

This post (and many you will see from me) is about rst2pdf, a tool to con­vert re­struc­tured text to PDF. For ex­am­ple, it turns the python li­brary ref­er­ence in­to this PDF (not pro­duc­tion qual­i­ty yet).

If you are a rst2pdf 0.11 user, or a sphinx or do­cu­tils us­er who wants to try an al­ter­na­tive way to cre­ate PDF­s, then I would like your help test­ing the SVN trunk code.

These are some of the new fea­tures since 0.11:

  • PDF­Builder, a Sphinx ex­ten­­sion to gen­er­ate PDF­s.

  • Kern­ing (re­quires wor­­daxe from SVN)

  • AAFig­ure sup­­port (di­a­­grams us­ing ASCII Art)

  • Page­Breaks can be odd­­/even/any

  • Sup­­port for ad­­vanced page coun­ters (man­u­al num­ber­ing, ro­­man/ara­bic/let­ter­s)

  • Much bet­ter styling, spe­­cial­­ly for ta­bles.

  • About two dozen bug­­fix­es.

So, please, take a look, you may like it!

PyCon Argentina 2009 Day 2

Ha, I thought I was very tired af­ter Day 1... not even close. Not af­ter how tired I was af­ter day 2!

First a short re­cap:

  • Got there (in time!)

  • Watched Fa­­cun­­do Batis­­ta's En­ten­di­en­­do Uni­­code

  • Fi­­nal­­ly pre­sen­t­ed PyQt + Wx­Python + PyGtk. And here are my slides.

    A huge thank you to Mar­i­ano Rein­­gart, Mar­i­ano Guer­ra, Daniel Mois­set and Javier Cas­tril­­lo who were there in rep­re­sen­­ta­­tion of Wx­Python and PyGtk. It was a very cor­­di­al af­­fair and lots of fun for ev­ery­one in­­­volved, I hope. Here are the Wx and PyGtk slides.

    On the oth­­er hand, this kind of thing is dead as fu­­ture talk sub­­­jec­t­s, at least to me. There is­n't much siz­­zle in it any­­more.

  • Lunch

  • A bit late for Mul­ti­pro­ce­samien­­to en Python by Clau­­dio Freire

  • Then I com­­plete­­ly did­n't fol­low Be­hind the sce­­nes: Python byte­­code by Matías Bor­dese be­­cause...

  • I had yet an­oth­er light­n­ing talk to give!

    It was an old trusty friend of mine, Ray­­mond Het­­tinger's spread­­sheet thingie and I even did slides, there was even time to get a neat xkcd re­f­er­ence in it... and the net­­book I was us­ing crapped out in slide #3.

    I could tell the joke (Mar­­cos Dione had a shirt with the ex­act need­ed xkcd strip in the back­­), but I re­al­­ly had a thing go­ing and .. well, it sucked.

    What the heck, I will try again next time.

    And yes, here are the slides I could­n't show

  • Then, last con­fer­­ence, Un­laden Swal­low by Collin Win­ter, which was very nice.

  • Then con­fer­­ence clos­ing, gifts for the luck­­y, some talk­ing, and home to rest.

In oth­er ar­eas:

I fi­nal­ly got my copy of the python tu­to­ri­al print­ed with rst2pdf. It's the first time ev­er a book has been type­set us­ing rst2pdf.

While the print­ing and bind­ing are (in­ten­tion­al­ly!) cheap, the type­set­ting was pret­ty good. Here are some pic­tures:

libro1libro2libro3libro4

And fi­nal­ly, I con­grat­u­late all the or­ga­niz­er­s, it was a beau­ti­ful­ly han­dled even­t!

Yay! sphinx-rst2pdf-builder works!

Ok, it kin­da works a lit­tle.

I got com­mit rights in the mer­cu­ri­al re­po, so now you can get the very very al­pha ver­sion here.

This trig­gered sev­er­al bugs in rst2pdf, so you need SVN rst2pdf for it to work.

What work­s:

  • Glos­sary

  • Plain re­struc­­tured text ... with some caveats (ex­am­­ple: foot­notes are semi-bro­ken)

  • In­­dex gen­er­a­­tion (not 100%, but maybe 75%)

I don't know what oth­er pieces of sphinx re­quire spe­cif­ic rst2pdf sup­port, but I will be hit­ting them as they come.


Contents © 2000-2023 Roberto Alsina