[Python] "TypeError: object of type 'NoneType' has no len()" while using fillpdfs

Discussão em 'Python' iniciado por Stack, Março 4, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently trying to create a program that allows me to auto-fill a pdf file using python and fillpdfs.

    This is the code so far:

    from fillpdf import fillpdfs

    form_fields = list(fillpdfs.get_form_fields('R7 Form - template.pdf').keys())

    name = 'TEST'
    furigana = 'テスト'

    birth_jp = '昭和'
    birth_year = '7'
    birth_month = '7'
    birth_day = '7'

    data_dict = {
    form_fields[7]: name,
    form_fields[5]: furigana,
    form_fields[10]: birth_year,
    form_fields[11]: birth_month,
    form_fields[12]: birth_day,
    form_fields[9]: birth_jp
    }

    fillpdfs.write_fillable_pdf('R7 Form - template.pdf', 'test.pdf', data_dict)


    I've tried cross-referencing it with things I'm seeing on the internet, and it looks fine. But it always throws the error. I'm not sure where I'm going wrong and what I need to be doing instead.

    Continue reading...

Compartilhe esta Página