def chapter_body(self, text): self.set_font("Arial", size=12) # Encode text to avoid Unicode errors text = text.encode('latin-1', 'replace').decode('latin-1') self.multi_cell(0, 10, text)