Closed sunshinewithmoonlight closed 4 years ago
Sorry to bother you, I found a solution to this problem: https://stackoverflow.com/questions/19712130/python-reportlab-unable-to-print-special-characters/19719908#19719908
You should replace &, < and > with the &, < and >. One easy way to do that is the Python escape function: from cgi import escape Story.append(Paragraph(escape("Some other text with &"), styles["Normal"])) However, HTML tags need to have real < and > so a typical use would be more like: text = "Some other text with &" Story.append(Paragraph(escape("" + text + ""), styles["Normal"]))
You can also do like this:
story = [Paragraph(a.replace(r'&',r'&').replace(r'<',r'<').replace(r'>',r'>'), styles['font_msyh'])]
Hello, my question is about reportlab.
When i run the following python code:
An error occurred: