redirectioneaza icon indicating copy to clipboard operation
redirectioneaza copied to clipboard

230 Form Autocompletion in Python

Open Skyrov01 opened this issue 2 years ago • 1 comments

Hi there. Wasn't sure where to ask this. I know it's somehow off topic, but. I'm trying to help my friends from an NGO and automate the 230 form completion. I have a few questions about this, and I would really love to share my solution when it will be ready.

Questions? Is there any way to automate this from Python? I know how to use pypdf, which although it might be the best solution it doesn't work properly.

Another method is using pikepdf, but then again, not sure how to handle the XML data attached to the document.

At this moment, I'm using pyautogui to automate clicks, copy & paste, etc. But isn't what I want in the end.

When I'm doing the following, the output is an empty dictionary.

from pypdf import PdfReader

reader = PdfReader("form_smart.pdf") 
fields = reader.get_fields() 
print(fields)
  • form_smart.pdf is the pdf given by ANAF: link
  • but when I'm doing the same thing with this type of PDF it works.

I'll be happy to discuss on this subject any time soon. Thanks Skyrov

Skyrov01 avatar Dec 28 '23 15:12 Skyrov01

Hey! Sorry for the late response but this is the first time we actually got to go through all of these issues in quite some time. What I can say is that we don't have a way to automate this completely just yet, but we have a way to generate the XML that the smart forms from ANAF can import and fill the form. I don't know if Adobe offers any way of doing this through a script.

Our code for building the XML is in backend/donations/views/donations_download.py and the instructions for filling the documents (in Romanian) are in backend/templates/v2/DESCRIERE.html

Hope this helps and if you have any more insights on this we'd be curious to hear them out. Cheers!

tudoramariei avatar Feb 14 '25 10:02 tudoramariei