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.
Related
My hello message is not visible...
I'm writing a 3D video game using Python (3.10) language with Panda3d (1.10) as 3D game engine.
Some graphical parts of the game are not 3D, there are just 2D elements:
spell bar,
player resume
quest panel
skill tree
etc
spells/attacks book
and others
I see on the web that pictures are used to styling Panda3D Direct* components.
However, in my opinion, I think use statics pictures (.png for exemple) is not efficient when game design must be evolved. That's why I prefer use HTML/CSS to render 2D elements, especially since CSS is very powerful if you know how to use it. I prefere to use SVG into the scene but I don't understand how create SVG file.
So, my question is:
Can I use HTML/CSS inside a Panda3d application?
Thank to all!
Have a nice day!
I think I've found a workaround (temporary).
I create HTML/CSS file that styling my 2D component that must be injected inside the Panda3D scene
I create a Python script that convert an HTML part as PNG picture using RGBA for transparency
I use the generated PNG picture inside my Panda3D scene on the target component.
It's not pure HTML/CSS, but it can works.
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?
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.
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.
I'm generating some pdf's with Reportlab and Django using a web interface. The pdf's are always going to be a single page. I'd like to generate a png or jpg image of the generated page and return that to the browser for the user to preview before saving the final pdf and delivering it to the end user. Is there anyway to do this?
This answer explains that you can use ghostscript to convert pdf to png. Depending of the requirements of your app (traffic, response time, nb of pdfs ...) it may or may not be a solution for you.
This is just an idea, but may be you can generate the preview image in parallel using PIL ImageDraw and get rid of the pdf-to-png conversion.
I hope it helps