Transfer XML to well formatted PDF table.
Project description
Convert your XML into a Pdf table
Since we forked the upstream this project has generalized quite a bit towards the generation of a multipage PDF file containing a table with subtables each containing a subset of an XML files content arranged in rows and columns. We work on this project mainly every quarter.
Table of content
- 💫 Quickstart
- 👓 Example
- 📖 Documentation
- 💻 Installation
- 💨 Coming soon
- 👋 Get in touch
- ⚠ Disclaimer
- ️© License
💫Quickstart
As a starting point you could call
$ python -m main.py input/my_test_download.xml
which will download a publicly available XML file into the folder input and process it as desired to produce the output files (one file containing all generated pages in landscape and additionally one file per page rotated into portrait) and place them in the subfolder output.
The intended way of using this software is calling main.py with the following command line parameters
-
positional arguments:
<local_file>
The local file path to the XML file. If this file is not present, the optional input parameter '--url' needs to be provided with the URL from which the file shall be downloaded.
-
optional arguments:
-u <URL>, --url <URL>
The URL from which the file shall be downloaded. This is only used, if the specified local file is not present. Defaults to 'https://www.alpinclub-berlin.de/kv/kursdaten.xml'-p <path to Pdf file>, --pdf <path to Pdf file>
The file path to store the created PDF to. Defaults to'output/kursdaten.pdf'
👓Example
Imagine you have an XML file with similar groups of tags and subtags.
<main_tag>
<row_tag>
<name_tag>Name 1</name_tag>
<info_tag>Info 1</info_tag>
<filter_tag>Filter_1, Filter_2</filter_tag>
</row_tag>
<row_tag>
<name_tag>Name 2</name_tag>
<info_tag>Info 2</info_tag>
<filter_tag>Filter_2, Filter_3</filter_tag>
</row_tag>
<row_tag>
<name_tag>Name 3</name_tag>
<info_tag>Info 3</info_tag>
<filter_tag>Filter_2</filter_tag>
</row_tag>
<row_tag>
<name_tag>Name 4</name_tag>
<info_tag>Info 4</info_tag>
<filter_tag>Filter_1, Filter_3</filter_tag>
</row_tag>
<row_tag>
<name_tag>Name 5</name_tag>
<info_tag>Info 5</info_tag>
<filter_tag>Filter_1</filter_tag>
</row_tag>
</main_tag>
Now you want to visualize all row_tag
s with their subtags name_tag
and info_tag
fed into separate columns. And lastly you want to group those row_tags
which
satisfy certain filter criteria, that is their filter_tag
contains certain
combinations of comma-separated texts. Those groups of row_tag
s are extracted into
several subtables each with a separating heading line and the corresponding column
headings.
📖Documentation
The full developer reference with all public interfaces you can find on ReadTheDocs . User documentation might still take a while for us to generate, since it is only us working on the project and using it as far as we know.
💻Installation
The installation of pyxml2pdf is as straightforward as the Python ecosystem suggests. Just create a virtual environment and install it via:
(venv) $ pip install pyxml2pdf
💨Coming soon
The next big step will be the deployment on Heroku.
👋Get in touch
In case you have any questions on this project do not hesitate to get in touch with us.
⚠Disclaimer
This software is developed in sole responsibility of Björn Ludwig. The software is made available "as is" free of cost. The author assumes no responsibility whatsoever for its use by other parties, and makes no guarantees, expressed or implied, about its quality, reliability, safety, suitability or any other characteristic. In no event will the author be liable for any direct, indirect or consequential damage arising in connection with the use of this software.
©License
pyxml2pdf is distributed under the GPLv3 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pyxml2pdf-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5eedffdfb8f733fa499045e96eb07b4bc04fff42947cc6d737580b19a68c42a1 |
|
MD5 | 5f869707368c2fdc090618a235b3e39d |
|
BLAKE2b-256 | 33f04ae8ea9248afdb2c27254b645711bc4dd6d7de87f548b9b8efab749064f6 |