'Filling PDF in Python with special characters

my intention is to fill fillable pdfs that contain special characters from spanish language (such as accents and letters like "ñ").

I have tried using fillpdf library, but I am not able to read correctly those characters:

from fillpdf import fillpdfs

pdf_fields = fillpdfs.get_form_fields("some_file.pdf")

When I print pdf_fields variable, I get characters like these:

{'■ \x00A\x005\x00[\x000\x00]': '', '■ \x00A\x006\x00[\x000\x00]': '', '■ \x00A\x007\x00[\x000\x00]': ''}

And I was expecting to be something like this:

{'field_name1': '', 'field_name2': '', 'field_name3': ''}

EDIT: Here is a sample PDF that I would like to fill. Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source