1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] FPDF encoding on writing not working in Python

Discussão em 'Python' iniciado por Stack, Setembro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to create a PDF file using Python and FPDF. I've read the project's page about unicode and I've tryed to follow their instructions, but everytime I run my program, I receave the error:


    File "eventsmanager.py", line 8 SyntaxError: Non-ASCII character '\xc3' in file eventsmanager.py on line 8, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
    ​

    This is my program:

    from fpdf import FPDF

    pdf = FPDF()
    pdf.add_page()

    pdf.add_font('gargi', '', 'gargi.ttf', uni=True)
    pdf.set_font('gargi', '', 14)
    pdf.write(8, 'Olá!!')
    pdf.ln(20)

    pdf.output('tuto3.pdf', 'F')


    Can you help me understanding what I'm doing wrong?

    Continue reading...

Compartilhe esta Página