30 lines
1.1 KiB
Markdown
30 lines
1.1 KiB
Markdown
# mlwerke2pdf
|
|
|
|
Python module to convert texts on http://www.mlwerke.de or https://www.marxists.org into Portable Document Format files
|
|
|
|
mlwerke2pdf fetches the linked subsites from the given table of contents and concats them to a single pdf
|
|
|
|
at this point links and linked images in the pdf are not functional as they point to the mlwerke html structure
|
|
converting them to pdf internal links would be possible but rather complex
|
|
|
|
|
|
# dependencies
|
|
uses python modules requests, BeautifulSoup4, urllib and weasyprint
|
|
|
|
# Usage as commandline util
|
|
python mlwerke2pdf_shutil.py -u URL -o PDF_OUTPUT_PATH [--dry True optional for not writing any files]
|
|
|
|
use the base / table of contents of a text like https://www.marxists.org/deutsch/archiv/marx-engels/1848/manifest/index.htm as URL
|
|
|
|
# Usage as Python module
|
|
|
|
## create MLWerke Object:
|
|
mlwerk = mlwerke2pdf.MLWerk(URL)
|
|
|
|
use the base / table of contents of a text like https://www.marxists.org/deutsch/archiv/marx-engels/1848/manifest/index.htm as URL
|
|
|
|
## generate a pdf
|
|
mlwerk.text2pdf(PDF_OUTPUT_PATH)
|
|
|
|
## or cominded into one line
|
|
mlwerke2pdf.MLWerk(URL).text2pdf(PDF_OUTPUT_PATH) |