How to create a layout for use with pisa (xhtml2pdf)? - python

I'm creating PDFs using pisa. The layouts I'm trying to convert to PDF have some absolute positioning which seems to be ignored by pisa. I could work around this limitation by using tables for layout. Are there any alternatives to this?

One way to do absolute positioning is to use the xhtml2pdf specific #frame blocks. See the documentation for details.

Related

How to remove borders on Tkinter buttons & frames?

I am currently building a simple app to encrypt files using AES encryption in python but the biggest downside of using Tkinter is the look of the UI. I did some research and found examples of what I want but do not know how to recreate it. (Example)
My problem is that when I replace buttons with images (like the OP of the Reddit post said he did in order to have a decent looking UI) I end up with an ugly bar of grey. (Image of the button)
I also want to remove the same type of bar with frames so if you have the answer for specifically that it would still be appreciated.
Support for for styles and themes has existed in tkinter for some time. A theme being a collection of styles for different widgets.
You can read more about style and themes here.
To the best of my knowledge, the standard widgets to not support rounded corners. All widgets have rectangular shapes.
You might be able to create something like that using a Canvas, but it would be a significant amount of work.
A more relevant point is that it might confuse your users if you don't reproduce the way the standard controls work.
UI elements are standardized for the same reason the controls in a car are; once you know one of them you can use all of them.

Reportlab printing defaults

I am using reportlab to create a pdf with some portait and some landscape pages. The pdf looks great on screen, but when printing it the default print settings are to shrink the pages, rather than rotate them. At first I though that this was just something to do with the settings, but a few other people have commented on it, using a variety of pdf readers and printers. After a bit of investigating it seems that this is something to do with an option set inside the pdf itself, recommending those print settings. Does anyone know of a way to change this when the pdf is generated?

Python: Printing Html in PDF using Reportlab Canvas

For one of my python project I am using reportlab's canvas feature to generate pdf document.
Can anyone please help me to print small subset of html (p, strong, ul, ol, li, img, alignments) on reportlab canvas?
Thanks in advance...
If this is what you are tying to do you should look at using Platypus with ReportLab, a built in set of classes in ReportLab for building documents out of objects representing page elements. Or, if you want really simple, xhtml2pdf would probably be better.

LaTeX type rendering with pygame

I am trying to read text with LaTeX formatting and render it using pygame. I am a novice to pygame and any help will be appreciated.
I looked into Glyph package. The problem is that I would have to rewrite all my .txt files in Glyph formatting for them to be useful. If I try and define macros I would essentially have to build a LaTeX translator. Both these options don't seem very practical considering the number of text files I have.
You could render LaTeX via matplotlib and use these figures in PyGame as sprites.
http://matplotlib.sourceforge.net/users/usetex.html
Check out pylasem (yes, it says MathML rendering library, but it also supports a subset of Latex) or lasem itself via gobject-introspection.

How to display interactive SVG in a window on Linux?

I really like SVG, it's very nice to draw with it. So far i've made static images using Inkscape. I'd like to make them interactive though.
I did some trials, following tutorials like this one. But i can see a SVG and interact with it in my web browser only. I'd like to make such things in a window on the desktop.
There are drawing kits like Cairo or OpenGL, but then i have to draw from code. It seems a more clever thing to use SVG (which was drawn using Inkscape).
What does it require to view interactive/animated SVG in a plain desktop window/canvas? I've seen some modules to convert SVG to Cairo: but is there a direct SVG intepreter for Linux?
The problem is that the effects require javascript and cascading style-sheets, which basically means complete web rendering engine. So the easiest way is to use one, either webkit or gecko (webkit has probably better support for SVG these days, plus I can't find package of gecko right now).

Categories