Skip to content

A worked example using the HMRC "Starter Checklist" of how to fill in a PDF pragmatically using Python

Notifications You must be signed in to change notification settings

blu3id/python-pdf-form-filling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filling the HMRC "Starter Checklist" PDF form using Python

This Snippet was to enable the HMRC Starter Checklist PDF to be pragmatically filled by a python app. It was "written" for a project (that didn't end up being presented) at NHS Hackday #22 in London.

For a little more background see my post "Snippet: Filling a PDF form using Python"

Install

Ensure pipenv is installed see https://docs.pipenv.org/ for how to setup on your platform of choice.

To get started and set-up virtualenv and install dependencies initially:

git clone https://github.com/blu3id/python-pdf-form-filling.git
cd python-pdf-form-filling
pipenv install --dev

Run

Edit starter_checklist.py so that the values of the starter_checklist dict corespond to the answers to the questions on the HMRC form.

starter_checklist = {
    'first_names': 'Frederic John',
    'last_name': 'Smith',
    'sex': 'm',  # Either 'm' or 'f'
    'date_of_birth': date(1980, 12, 30),
    'address': "123 Fake Street \n Westminster \n London",
    'postcode': 'AB1 2CD',
    'country': 'United Kingdom',
    'ni_number': 'AB123456F',
    'employment_start': date.today(),
    'question_8': 'a',  # 'a', 'b' or 'c'
    'question_9': True,
    'question_10': False,
    'question_11': '',
    'question_12': '',  # '1', '2', 'b'
    'question_13': False,
    'question_14': '',
    'question_15': '',
}

Then run python starter_checklist.py to produce starter_form.pdf

About

A worked example using the HMRC "Starter Checklist" of how to fill in a PDF pragmatically using Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages