Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPF-394: update variable names in examples #395

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This part of the documentation provides some useful example code snippets that
can be used out of box.

## Preparing PDF Form
## Preparing a PDF Form

The most common tool to create a PDF form is Adobe Acrobat. A tutorial can be found
[here](https://helpx.adobe.com/acrobat/using/creating-distributing-pdf-forms.html).
Expand All @@ -26,11 +26,11 @@ PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form

PATH_TO_FILLED_PDF_FORM = os.path.join(
PATH_TO_PDF_FORM_PREVIEW = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
) # Change this to where you wish to put your PDF form preview

with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
with open(PATH_TO_PDF_FORM_PREVIEW, "wb+") as output:
output.write(
PyPDFForm(PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM).preview
)
Expand Down Expand Up @@ -286,11 +286,11 @@ PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form

PATH_TO_FILLED_PDF_FORM = os.path.join(
PATH_TO_OUTPUT_PDF_FORM = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
) # Change this to where you wish to put your output PDF form

with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
with open(PATH_TO_OUTPUT_PDF_FORM, "wb+") as output:
output.write(
PyPDFForm(PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM)
.draw_text("drawn_text", 1, 300, 225)
Expand All @@ -311,15 +311,15 @@ PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form

PATH_TO_FILLED_PDF_FORM = os.path.join(
PATH_TO_OUTPUT_PDF_FORM = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
) # Change this to where you wish to put your output PDF form

PATH_TO_IMAGE = os.path.join(
os.path.expanduser("~"), "sample_image.jpg"
) # Change this to the location of an image of your choice

with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
with open(PATH_TO_OUTPUT_PDF_FORM, "wb+") as output:
output.write(
PyPDFForm(PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM)
.draw_image(PATH_TO_IMAGE, 2, 100, 100, 400, 225, 0)
Expand All @@ -340,11 +340,11 @@ PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form

PATH_TO_FILLED_PDF_FORM = os.path.join(
PATH_TO_OUTPUT_PDF_FORM = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
) # Change this to where you wish to put your output PDF form

with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
with open(PATH_TO_OUTPUT_PDF_FORM, "wb+") as output:
filled_pdf = PyPDFForm()

for i in range(3):
Expand Down Expand Up @@ -424,11 +424,11 @@ PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM = os.path.join(
os.path.expanduser("~/Downloads"), "sample_template.pdf"
) # Change this to where you downloaded the sample PDF form

PATH_TO_FILLED_PDF_FORM = os.path.join(
PATH_TO_NEW_VERSION_PDF_FORM = os.path.join(
os.path.expanduser("~"), "output.pdf"
) # Change this to where you wish to put your filled PDF form
) # Change this to where you wish to put your new version PDF form

with open(PATH_TO_FILLED_PDF_FORM, "wb+") as output:
with open(PATH_TO_NEW_VERSION_PDF_FORM, "wb+") as output:
output.write(
PyPDFForm(PATH_TO_DOWNLOADED_SAMPLE_PDF_FORM)
.change_version("2.0")
Expand Down