Styling HTML to PDF with iText 2.1.7

There are various solutions for producing PDFs from a HTML file, some with excellent results (e.g. ones based on the chrome renderer). Unfortunately, they usually mean adding more dependencies to an existing system. To keep things in check, we’ve chosen to use iText to generate PDFs. Following the previous post, we need to enhance the […]

Strip HTML tags in python

Note: This is a post transferred from Laurii for historical and consolidation purposes. A common problem I have to deal with quite often is to remove all HTML tags from a document. While this is easy for XML (well formatted etc.) and you could do it by hand with a regexp, HTML has a bit […]

Copy Text to Clipboard in HTML Page using JavaScript

I’ve got a problem on one of my sites: I have a unique identifier displayed on one page, which I need to make it easy to copy to clipboard. After looking online, I’ve found three approaches using only JS. Clipboard.js Clipboard.js is a new (September 2015) approach which uses only JS to copy the text […]

Send POST to server via python-requests

The other day I’ve had a question asked: How do you send a form data to a server and get the reply? My solution involves python-requests:

r.text contains the reply HTML page, which then needs to be processed via e.g. python’s DOM processing module or BeautifulSoup (if you’re looking for something more tolerant). HTH, […]

Decent image loader widget in django

I’m working on a website where I need to be able to load an image. The default widget is abysmal; it has a url to the current image, a checkbox and a file loader input element. Even styled, it looks pretty bad. So, I’ve taken upon myself to prettify it and get from this: to […]

Scroll to top