Skip to content

Commit 2c0e0aa

Browse files
Merge pull request #911 from chinapandaman/PPF-910
PPF-910: improve doc wordings
2 parents 728569f + 37c6eff commit 2c0e0aa

16 files changed

+95
-149
lines changed

docs/button_style.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Change checkbox and radio button styles
22

3-
Similar to text fields discussed in the last chapter, PyPDFForm gives you the ability to
4-
modify some styles of checkboxes and radio buttons without changing the template.
3+
PyPDFForm allows you to modify certain styles of checkboxes and radio buttons without altering the template, similar to text fields.
54

65
## Change size
76

8-
You can change the size of the selection by specifying a `float` value. Consider
7+
To change the size of the selection, specify a `float` value. For an example, refer to
98
[this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf):
109

1110
```python
@@ -30,8 +29,8 @@ with open("output.pdf", "wb+") as output:
3029

3130
## Change button style
3231

33-
The button style is the shape of the selection on a checkbox or radio button. PyPDFForm lets you pick
34-
three different button styles: `check`, `circle`, and `cross`. Consider
32+
The button style determines the shape of the selection on a checkbox or radio button. PyPDFForm offers
33+
three button styles: `check`, `circle`, and `cross`. For an example, see
3534
[this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template_with_radio_button.pdf):
3635

3736
```python

docs/coordinate.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# PDF coordinates
22

3-
The coordinate system on a single page of a PDF starts at the bottom left of the page as the origin. The unit of
4-
the coordinates is called "points" and there are 72 points/inch. PyPDFForm utilizes this coordinate system in
5-
some of its APIs so that widgets, texts, or images can be created on a PDF.
3+
The PDF coordinate system originates at the bottom left of the page. The unit of measurement is "points," with 72 points per inch. PyPDFForm uses this coordinate system in its APIs to create widgets, text, or images on a PDF.
64

75
## Generate a coordinate grid view
86

9-
To allow a better user experience with the coordinate system, PyPDFForm implements a grid view so that there is a
10-
better idea on where stuffs should be placed on a PDF.
7+
To enhance the user experience with the coordinate system, PyPDFForm provides a grid view that helps determine the optimal placement of elements on a PDF.
118

129
Consider [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf), the
1310
coordinate grid view can be generated like this:
@@ -26,6 +23,4 @@ with open("output.pdf", "wb+") as output:
2623
output.write(grid_view_pdf.read())
2724
```
2825

29-
The `generate_coordinate_grid` method takes two optional parameters. The first one is `color` which allows you to pick
30-
a color for the grid view. The default color is red. The second one is `margin` which allows you to change the
31-
coordinate grid view's margin in points. The default margin is 100 points.
26+
The `generate_coordinate_grid` method accepts two optional parameters: `color` and `margin`. The `color` parameter sets the grid view color, defaulting to red. The `margin` parameter adjusts the coordinate grid view's margin in points, with a default of 100 points.

docs/dev_changes.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
# Pull Request Requirements
22

3-
Whenever a pull request is submitted, there are some expectations for the content before it can be merged
4-
into the master branch.
3+
When submitting a pull request, certain expectations must be met before it can be merged into the master branch.
54

65
## Code changes
76

8-
There isn't any strict rule on how coding should be done for PyPDFForm. The project welcomes code contributions from
9-
anyone with any level of expertise.
7+
PyPDFForm doesn't have strict coding rules, welcoming contributions from developers of all expertise levels.
108

119
With that said, there are some conventions that are expected to be followed by your PR:
1210

13-
* Small changes are preferred over lengthy changes. If your changes are large, please request a feature branch in your issue
14-
and open your PR against that branch, as your changes will likely need to be revised before merging into master.
11+
* Small, incremental changes are preferred. For large changes, request a feature branch in your issue and open your PR against that branch, as they will likely require revision before merging into master.
1512
* Your changes must pass [Pylint](https://www.pylint.org/). To check if this is true, simply run `pylint PyPDFForm`.
1613
* Your changes must pass all tests and have 100% coverage. You can read more about testing [here](dev_test.md).
1714
* If you are changing the user APIs or any other parts of the code that are relevant, please update the appropriate documentation too.
1815

1916
## Merge process
2017

21-
Your PR will be reviewed before merging into the master branch. In the case where your changes are too large to leave review comments,
22-
you will likely be asked to reopen your PR against a new feature branch so that your changes can be revised/refactored to the appropriate code structure.
18+
Your PR will undergo review before being merged into the master branch. If your changes are too extensive for inline review comments, you may be asked to reopen your PR against a new feature branch for revision and refactoring.
2319

2420
On top of that, your PR needs to run through some CI checks:
2521

docs/dev_doc.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
# Hosting Docs Locally
22

3-
When the changes apply to the user APIs or any other parts of the code that are relevant, the appropriate documentation should
4-
also be updated.
3+
Update the relevant documentation when changing user APIs or other significant code sections.
54

6-
PyPDFForm uses [MkDocs](https://www.mkdocs.org/) for building the documentation. To host the doc site locally, simply run:
5+
PyPDFForm uses [MkDocs](https://www.mkdocs.org/) to build its documentation. To host the documentation locally, run:
76

87
```shell
98
mkdocs serve
109
```
1110

12-
And you will find the doc site at `http://127.0.0.1:8000/`.
11+
The documentation will be available at `http://127.0.0.1:8000/`.
1312

14-
Alternatively, in the development container, run:
13+
Alternatively, to run the documentation in the development container:
1514

1615
```shell
1716
docs
1817
```
1918

20-
And you will find the doc site at `http://localhost:8000/`.
19+
The documentation will be available at `http://localhost:8000/`.

docs/dev_intro.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# Developer Intro
22

3-
PyPDFForm's targeted users are other Python developers. This section of the documentation is not for the users,
4-
but for people who want to start making contributions to PyPDFForm itself.
3+
PyPDFForm is designed for Python developers. This documentation section is intended for contributors to PyPDFForm, not its end-users.
54

65
## Setup
76

8-
Create a virtual environment, then install all development dependencies using a package manager of your choice.
7+
To get started, create a virtual environment and install the development dependencies using your preferred package manager.
98

109
The command below uses [uv](https://docs.astral.sh/uv/):
1110

1211
```shell
1312
uv pip install -r pyproject.toml --extra dev
1413
```
1514

16-
Alternatively, PyPDFForm provides a development container. Build it by running this command at the root directory of the project:
15+
PyPDFForm also offers a development container. To build it, run the following command in the project's root directory:
1716

1817
```shell
1918
docker build -t pypdfform-dev .
@@ -31,7 +30,7 @@ See [testing PyPDFForm with pytest](dev_test.md).
3130

3231
## Creating issues
3332

34-
When you create an issue on GitHub, try your best to follow these conventions:
33+
When creating a GitHub issue, follow these guidelines:
3534

3635
* The issue title should have the format `PPF-<issue number>: <title of the issue>`.
3736
* The issue description should be as descriptive as possible, preferably with the following:
@@ -41,7 +40,7 @@ When you create an issue on GitHub, try your best to follow these conventions:
4140

4241
## Opening pull requests
4342

44-
Please create an issue before making a pull request. Try your best to follow these conventions when doing so:
43+
Before opening a pull request, create an issue. When opening the pull request, follow these guidelines:
4544

4645
* The PR title should be the same as its respective issue, so `PPF-<issue number>: <title of the issue>`.
4746
* The PR description should contain a brief explanation of the changes.

docs/dev_release.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# Releasing
22

3-
A PyPDFForm release starts with the following steps:
3+
The PyPDFForm release process begins with the following steps:
44

5-
* A release [issue](https://github.com/chinapandaman/PyPDFForm/issues/686) and [PR](https://github.com/chinapandaman/PyPDFForm/pull/687).
6-
* A new [GitHub release](https://github.com/chinapandaman/PyPDFForm/releases) with auto-generated changelogs.
5+
* Creating a release [issue](https://github.com/chinapandaman/PyPDFForm/issues/686) and [PR](https://github.com/chinapandaman/PyPDFForm/pull/687).
6+
* Publishing a new [GitHub release](https://github.com/chinapandaman/PyPDFForm/releases) with auto-generated changelogs.
77

8-
Once these steps are done, the CI for deployment will be triggered.
8+
After completing these steps, the deployment CI will be triggered.
99

1010
## Versioning
1111

1212
PyPDFForm follows the conventions defined by [Semantic Versioning](https://semver.org/).
1313

1414
## Deploy process
1515

16-
When the GitHub release is created, it will trigger two different CIs:
16+
Creating a GitHub release triggers two CIs:
1717

1818
* [Deploy](https://github.com/chinapandaman/PyPDFForm/actions/workflows/python-publish.yml), which will create the distribution and upload it to [PyPI](https://pypi.org/project/PyPDFForm/).
1919
* [Deploy Docs](https://github.com/chinapandaman/PyPDFForm/actions/workflows/deploy-docs.yml), which will tear down and rebuild the [GitHub page](https://chinapandaman.github.io/PyPDFForm/) where the doc site is hosted.
2020

2121
## When are releases done?
2222

23-
It depends on the changes that are currently on the master branch but have not deployed yet. Generally speaking:
23+
The timing of releases depends on the changes pending deployment on the master branch. Generally:
2424

2525
* Serious bugs are usually released immediately after they are fixed.
2626
* New features can usually wait and are released on a weekly basis.

docs/dev_test.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Testing
22

3-
PyPDFForm uses [pytest](https://pytest.org/) for testing and [coverage.py](https://coverage.readthedocs.io/)
4-
for test coverages. Tests can be run by simply executing:
3+
PyPDFForm uses [pytest](https://pytest.org/) for testing and [coverage.py](https://coverage.readthedocs.io/)
4+
for measuring test coverage. To run the tests, execute:
55

66
```shell
77
coverage run -m pytest && coverage report --fail-under=100
@@ -15,13 +15,13 @@ test
1515

1616
## Generate coverage report
1717

18-
To generate a coverage report, run:
18+
To generate a test coverage report, run:
1919

2020
```shell
2121
coverage run -m pytest && coverage html
2222
```
2323

24-
And the coverage report can be viewed by opening `htmlcov/index.html` in a browser.
24+
View the coverage report by opening `htmlcov/index.html` in a browser.
2525

2626
Alternatively, in the development container, run:
2727

@@ -33,9 +33,9 @@ And the coverage report can be found at `http://localhost:8000/htmlcov/index.htm
3333

3434
## Test breakdown
3535

36-
Each PyPDFForm test is different. However, there is a general paradigm that almost all tests follow.
36+
Although each PyPDFForm test is unique, most follow a general paradigm.
3737

38-
In most cases, a test can be verbally summed up into three steps:
38+
Most tests can be summarized into three steps:
3939

4040
* Define an expected PDF file that the outcome of the test should look like.
4141
* Execute a sequence of code using PyPDFForm to generate a PDF that should look like the expected PDF file.
@@ -92,7 +92,7 @@ obj = PdfWrapper(
9292
)
9393
```
9494

95-
These two lines should almost always be included in every test to make updating old tests easier:
95+
Include these two lines in most tests to simplify updating old tests:
9696

9797
```python
9898
request.config.results["expected_path"] = expected_path

docs/draw.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
# Draw stuffs
1+
# Draw elements
22

3-
PyPDFForm allows you to draw certain elements on a PDF. The purpose is in case there is a missing widget on your PDF
4-
form, and you need to put certain texts on it, or if you need to draw images.
3+
PyPDFForm enables drawing elements on a PDF, which is useful when a widget is missing from your PDF form or when you need to add text or images.
54

65
This section of the documentation will use
76
[this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf) as an example.
87

9-
This section of the documentation requires a basic understanding of [the PDF coordinate system](coordinate.md).
8+
Understanding [the PDF coordinate system](coordinate.md) is necessary for this section.
109

1110
All optional parameters will have a comment `# optional` after each of them.
1211

13-
**NOTE:** Due to a known bug in a dependency, it is advised that these draw methods are called after
14-
a PDF form is filled. Otherwise, part (most noticeably radio buttons) or even all widgets of the PDF form might
15-
get removed after drawing things on it.
12+
**NOTE:** Due to a known bug in a dependency, call the draw methods after filling the PDF form. Otherwise, some or all widgets, especially radio buttons, might be removed.
1613

1714
## Draw text
1815

docs/fill.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Fill a PDF form
22

3-
PyPDFForm uses a single depth, non-nested dictionary to fill a PDF form. As a result of this process, the filled
4-
PDF form will be flattened and no longer editable. This is to prevent future encoding issues, especially when
5-
multiple PDF forms with overlaps on widget names are combined.
3+
PyPDFForm fills a PDF form using a flat, non-nested dictionary. The filled form is flattened and becomes non-editable to prevent encoding issues when combining multiple forms with overlapping widget names.
64

75
## Fill text field and checkbox widgets
86

9-
As seen when we
10-
inspected [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf), a text
11-
field can be filled with a value of `string`, whereas a checkbox can be filled with a `boolean` value:
7+
When inspecting [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf), note that text fields are filled with `string` values and checkboxes with `boolean` values.
128

139
```python
1410
from PyPDFForm import PdfWrapper
@@ -30,7 +26,7 @@ with open("output.pdf", "wb+") as output:
3026

3127
## Fill radio button widgets
3228

33-
A radio button group on a PDF form is a collection of radio buttons that share the same name.
29+
A radio button group is a collection of radio buttons sharing the same name on a PDF form.
3430

3531
A [PDF form](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template_with_radio_button.pdf)
3632
with radio button groups can be filled using `integer` values where the value indicates which radio button to select
@@ -53,8 +49,8 @@ with open("output.pdf", "wb+") as output:
5349

5450
## Fill dropdown widgets
5551

56-
Similar to radio buttons, a dropdown choice can be selected by specifying an `integer` value of the choice. Consider
57-
[this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/dropdown/sample_template_with_dropdown.pdf):
52+
Like radio buttons, select a dropdown choice by specifying its `integer` value. For an example, see
53+
[this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/dropdown/sample_template_with_dropdown.pdf).
5854

5955
```python
6056
from PyPDFForm import PdfWrapper
@@ -71,8 +67,7 @@ with open("output.pdf", "wb+") as output:
7167

7268
## Fill signature widgets
7369

74-
A signature field widget allows you to sign a PDF form in a handwritten format. PyPDFForm lets you use a signature image to populate
75-
any signature field widget.
70+
A signature field widget enables signing a PDF form with a handwritten signature image.
7671

7772
Consider [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/signature/sample_template_with_signature.pdf)
7873
and [this signature image](https://github.com/chinapandaman/PyPDFForm/raw/master/image_samples/sample_signature.png):
@@ -90,8 +85,7 @@ with open("output.pdf", "wb+") as output:
9085
output.write(signed.read())
9186
```
9287

93-
**NOTE:** As described [here](install.md/#create-a-pdf-wrapper), the value of the signature in your dictionary can be
94-
a file path shown above, but also an open file object and a file stream that's in `bytes`.
88+
**NOTE:** The signature value in your dictionary can be a file path, an open file object, or a `bytes` file stream, as described [here](install.md/#create-a-pdf-wrapper).
9589

9690
By default, the library preserves the aspect ratio of the signature image when filling it. This can be turned off by setting
9791
the `preserve_aspect_ratio` property to `False` on the signature widget:
@@ -113,8 +107,7 @@ with open("output.pdf", "wb+") as output:
113107

114108
## Fill image widgets
115109

116-
An image field widget can be filled similarly to a signature field, by providing a value of file path, file object, or
117-
file stream.
110+
Fill an image field widget similarly to a signature field, using a file path, file object, or file stream.
118111

119112
Consider [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template_with_image_field.pdf)
120113
and [this image](https://github.com/chinapandaman/PyPDFForm/raw/master/image_samples/sample_image.jpg):
@@ -152,8 +145,7 @@ with open("output.pdf", "wb+") as output:
152145

153146
## Disable rendering widgets
154147

155-
By default, PyPDFForm will still render each widget on the filled PDF form even though it's flattened during filling the process. This behavior can be disabled globally by passing
156-
the `render_widgets` parameter as `False` to the `PdfWrapper` object. Consider [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf):
148+
By default, PyPDFForm renders widgets on the filled PDF form despite flattening during the filling process. To disable this globally, pass `render_widgets=False` to the `PdfWrapper` object. For an example, see [this PDF](https://github.com/chinapandaman/PyPDFForm/raw/master/pdf_samples/sample_template.pdf).
157149

158150
```python
159151
from PyPDFForm import PdfWrapper
@@ -173,8 +165,7 @@ with open("output.pdf", "wb+") as output:
173165
output.write(filled.read())
174166
```
175167

176-
Alternatively, if you just want to disable rendering of some widgets but not others, you can do so at each widget's level by setting the attribute
177-
`render_widget` to `False`:
168+
To disable rendering for specific widgets, set the `render_widget` attribute to `False` at the individual widget level.
178169

179170
```python
180171
from PyPDFForm import PdfWrapper

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ It also supports other common utilities such as extracting pages and merging mul
1919
* [Fill a PDF form in place](simple_fill.md)
2020
* [Change text field styles](style.md)
2121
* [Change checkbox and radio button styles](button_style.md)
22-
* [Draw stuffs](draw.md)
22+
* [Draw elements](draw.md)
2323
* [Other utilities](utils.md)
2424

2525
## Developer Guide

0 commit comments

Comments
 (0)