From 148133fcf1541a768a2d4862cb6772cb348e8f19 Mon Sep 17 00:00:00 2001 From: chinapandaman <benjaminli801@gmail.com> Date: Sat, 16 Mar 2024 18:56:01 -0500 Subject: [PATCH] PPF-524: update docs --- docs/install.md | 4 ++++ docs/simple_fill.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/docs/install.md b/docs/install.md index 1bdc8999..78f75428 100644 --- a/docs/install.md +++ b/docs/install.md @@ -21,6 +21,10 @@ pip install -U PyPDFForm ## Create a PDF wrapper +There are two classes provided by the library that abstract a PDF form. The `FormWrapper` class allows you to fill a +PDF form if you don't need any other API. More info about `FormWrapper` can be found +[here](simple_fill.md). + The class that implements most of PyPDFForm's APIs is `PdfWrapper`. It takes various optional parameters to instantiate, with the most important one being the PDF form "template". diff --git a/docs/simple_fill.md b/docs/simple_fill.md index f4a4234a..a5e352a0 100644 --- a/docs/simple_fill.md +++ b/docs/simple_fill.md @@ -1 +1,32 @@ # Fill a PDF form in place (beta) + +**NOTE:** This page contains beta features, meaning it's known that these features do not support some PDF forms but +currently there are no plans and/or solutions to fix them. + +The `FormWrapper` class allows you to fill a PDF form in place as if you were filling it manually. The resulted filled +PDF form will NOT be flattened and will still be editable. + +Similar to the `PdfWrapper` class, the `FormWrapper` also supports widgets including text fields, checkboxes, radio +buttons, dropdowns, and paragraphs. However, it does NOT support signature widgets. + +Consider [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/dropdown/sample_template_with_dropdown.pdf): + +```python +from PyPDFForm import FormWrapper + +filled = FormWrapper("sample_template_with_dropdown.pdf").fill( + { + "test_1": "test_1", + "test_2": "test_2", + "test_3": "test_3", + "check_1": True, + "check_2": True, + "check_3": True, + "radio_1": 1, + "dropdown_1": 1, + }, +) + +with open("output.pdf", "wb+") as output: + output.write(filled.read()) +```