diff --git a/WestHealth.ipynb b/WestHealth.ipynb index eddb8f3..64ef884 100644 --- a/WestHealth.ipynb +++ b/WestHealth.ipynb @@ -641,7 +641,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 64, "metadata": {}, "outputs": [], "source": [ @@ -693,6 +693,9 @@ " try:\n", " if type(annotation[ANNOT_VAL_KEY]) == pdfrw.objects.pdfstring.PdfString:\n", " data_dict[key] = pdfrw.objects.PdfString.decode(annotation[ANNOT_VAL_KEY])\n", + " elif type(annotation[ANNOT_VAL_KEY]) == pdfrw.objects.pdfname.BasePdfName:\n", + " if '/' in annotation[ANNOT_VAL_KEY]:\n", + " data_dict[key] = annotation[ANNOT_VAL_KEY][1:]\n", " except:\n", " pass\n", " elif annotation['/AP']:\n", @@ -908,7 +911,14 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 65, "metadata": {}, "outputs": [], "source": [ @@ -917,7 +927,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 66, "metadata": {}, "outputs": [ { @@ -928,17 +938,17 @@ " 'Dropdown1': '6',\n", " 'Dropdown3': '2025',\n", " 'Address': 'iejijiejfi',\n", - " 'Check Box1': '/Yes',\n", - " 'Check Box2': '/',\n", - " 'Check Box3': '/',\n", - " 'Check Box4': '/',\n", + " 'Check Box1': 'Yes',\n", + " 'Check Box2': '',\n", + " 'Check Box3': '',\n", + " 'Check Box4': '',\n", " 'Text5': 'Yo',\n", " 'Group6': '3',\n", " 'Text6': 'Man',\n", " 'Button7': None}" ] }, - "execution_count": 65, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } @@ -951,7 +961,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 77, "metadata": {}, "outputs": [], "source": [ @@ -978,10 +988,10 @@ " 'Dropdown1': '6',\n", " 'Dropdown3': '2025',\n", " 'Address': 'iejijiejfi',\n", - " 'Check Box1': '/Yes',\n", - " 'Check Box2': '/',\n", - " 'Check Box3': '/',\n", - " 'Check Box4': '/',\n", + " 'Check Box1': '',\n", + " 'Check Box2': 'Yes',\n", + " 'Check Box3': '',\n", + " 'Check Box4': '',\n", " 'Text5': 'Yo',\n", " 'Group6': '3',\n", " 'Text6': 'Man',\n", @@ -999,7 +1009,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 78, "metadata": {}, "outputs": [], "source": [ @@ -1008,7 +1018,7 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 79, "metadata": {}, "outputs": [], "source": [ @@ -1017,7 +1027,7 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 80, "metadata": {}, "outputs": [], "source": [ @@ -1026,11 +1036,11 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 81, "metadata": {}, "outputs": [], "source": [ - "write_fillable_pdf('new_samp.pdf', 'samp2.pdf', data_dict)" + "fillpdfs.write_fillable_pdf('new_samp.pdf', 'samp2.pdf', data_dict)" ] }, { diff --git a/fillpdf.egg-info/PKG-INFO b/fillpdf.egg-info/PKG-INFO index 2fa0571..fc7abd1 100644 --- a/fillpdf.egg-info/PKG-INFO +++ b/fillpdf.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: fillpdf -Version: 0.4.1 +Version: 0.4.2 Summary: A Library to fill and flatten pdfs Home-page: https://github.com/t-houssian/fillpdf Author: Tyler Houssian diff --git a/fillpdf/__pycache__/fillpdfs.cpython-38.pyc b/fillpdf/__pycache__/fillpdfs.cpython-38.pyc index 945bdd2..7e2d133 100644 Binary files a/fillpdf/__pycache__/fillpdfs.cpython-38.pyc and b/fillpdf/__pycache__/fillpdfs.cpython-38.pyc differ diff --git a/fillpdf/fillpdfs.py b/fillpdf/fillpdfs.py index b2afb4e..ff2fe78 100644 --- a/fillpdf/fillpdfs.py +++ b/fillpdf/fillpdfs.py @@ -46,6 +46,9 @@ def get_form_fields(input_pdf_path): try: if type(annotation[ANNOT_VAL_KEY]) == pdfrw.objects.pdfstring.PdfString: data_dict[key] = pdfrw.objects.PdfString.decode(annotation[ANNOT_VAL_KEY]) + elif type(annotation[ANNOT_VAL_KEY]) == pdfrw.objects.pdfname.BasePdfName: + if '/' in annotation[ANNOT_VAL_KEY]: + data_dict[key] = annotation[ANNOT_VAL_KEY][1:] except: pass elif annotation['/AP']: diff --git a/setup.cfg b/setup.cfg index 4776d3f..31ac40f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] t-houssian: name = fillpdf -version = 0.4.1 +version = 0.4.2 author = Tyler Houssian author_email = tylerhoussian@gmail.com description = A Library to fill and flatten pdfs diff --git a/setup.py b/setup.py index 418fa06..285fd29 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='fillpdf', packages=find_packages(exclude=['tests']), - version='0.4.1', + version='0.4.2', install_requires=install_requires, description='A Library to fill and flatten pdfs', long_description=long_description,