Transfer XML to well formatted PDF table.
Project description
Convert your XML into a Pdf table
Generate a multi-page PDF file from an XML file with the contents displayed in several tables based on filter criteria.
Table of content
- 💫 Quickstart
- 👓 Example
- 📖 Documentation
- 💻 Installation
- 💨 Coming soon
- 👋 Get in touch
- 💎 Acknowledgement
- ⚠ Disclaimer
- ️© License
💫Quickstart
As a starting point you could call
$ python -m pyxml2pdf.main input/template.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://github.com/BjoernLudwigPTB/pyxml2pdf/blob/main/input/template.xml'-p <path to Pdf file>, --pdf <path to Pdf file>
The file path to store the created PDF to. Defaults to'output/template.pdf'
👓Example
As an example we look at our input/template.xml and the processed result. 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 API reference you can find on ReadTheDocs.
💻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.
💎Acknowledgement
This project was prepared by Wojciech Kur in his repository XMLtoPDFConverter. We are grateful for his effort in designing the basic structure and built upon his main ideas. At some point our project diverged as much from his original work, as for us to justify to decouple our project from his. The fork is still kept (and maintained) as a special case in pyacb2pdf.
⚠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
File details
Details for the file pyxml2pdf-0.3.4.tar.gz
.
File metadata
- Download URL: pyxml2pdf-0.3.4.tar.gz
- Upload date:
- Size: 391.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27bee0e1b8077bc1b770c760a3509a80ab35dac7f7f2d8c6e55b3e6a3281a681 |
|
MD5 | 1d1094289f66b1f7c2607c2e7a739139 |
|
BLAKE2b-256 | 2597e96a92b025ca43d038239ff187f9774e6d2ee580fa38f60f76156592c626 |
File details
Details for the file pyxml2pdf-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: pyxml2pdf-0.3.4-py3-none-any.whl
- Upload date:
- Size: 394.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2b637c4d452297a3c27929ce6fc8b42f0e46bf38d8072b0b46694aa4d95ca01 |
|
MD5 | c9804066b4d07f53552cc56373ff61b1 |
|
BLAKE2b-256 | 2b910245d696fd944af74efc6b6a0c3efef5a51420ee8822dec6e24a8e22b41d |