summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJames R. Barlow <james@purplerock.ca>2022-06-09 00:38:21 -0700
committerJames R. Barlow <james@purplerock.ca>2022-06-09 00:38:21 -0700
commitb1b336cb481fb3fec1ebf86f7ddb1911f3844bd8 (patch)
treed76a7c24c3fa9d5c23427fcc1a1606fbf327d416 /docs
parenta1468a98d6b4647d93cdcd996567282abd0c389d (diff)
docs: improve intro example
Diffstat (limited to 'docs')
-rw-r--r--docs/index.rst9
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 25778b2..b93ba07 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -27,10 +27,11 @@ to encrypted PDFs.
# Rotate all pages in a file by 180 degrees
import pikepdf
- my_pdf = pikepdf.Pdf.open('test.pdf')
- for page in my_pdf.pages:
- page.Rotate = 180
- my_pdf.save('test-rotated.pdf')
+
+ with pikepdf.Pdf.open('test.pdf') as my_pdf:
+ for page in my_pdf.pages:
+ page.Rotate = 180
+ my_pdf.save('test-rotated.pdf')
It is a low level library that requires knowledge of PDF internals and some
familiarity with the `PDF specification