diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-10-27 03:02:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-10-27 03:02:19 +0000 |
commit | f2038241cc91dbeee206151c1c17a3c42c5e1968 (patch) | |
tree | 33c29ba68db5ed7e9455a3922ff5f130ba52996e /docs/first_steps.rst | |
parent | Initial commit. (diff) | |
download | pydyf-f2038241cc91dbeee206151c1c17a3c42c5e1968.tar.xz pydyf-f2038241cc91dbeee206151c1c17a3c42c5e1968.zip |
Adding upstream version 0.1.1.upstream/0.1.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/first_steps.rst')
-rw-r--r-- | docs/first_steps.rst | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/first_steps.rst b/docs/first_steps.rst new file mode 100644 index 0000000..61d967f --- /dev/null +++ b/docs/first_steps.rst @@ -0,0 +1,36 @@ +First Steps +=========== + + +Installation +------------ + +The easiest way to use pydyf is to install it in a Python `virtual +environment`_. When your virtual environment is activated, you can then install +pydyf with pip_:: + + pip install pydyf + +.. _virtual environment: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/ +.. _pip: https://pip.pypa.io/ + + +Create a PDF +------------ + +.. code-block:: python + + import pydyf + + document = pydyf.PDF() + + # Add an empty page + document.add_page(pydyf.Dictionary({ + 'Type': '/Page', + 'Parent': document.pages.reference, + 'MediaBox': pydyf.Array([0, 0, 200, 200]), + })) + + # Write to document.pdf + with open('document.pdf', 'wb') as f: + document.write(f) |