5 ms·
like this: sudo apt install pandoc wkhtmltopdf npm install -g readability-cli pandoc -s https://www.paulgraham.com/avg.html -o output.html && readable ou
by pavs 3y ago
like this:
sudo apt install pandoc wkhtmltopdf
npm install -g readability-cli
pandoc -s https://www.paulgraham.com/avg.html -o output.html && readable output.html -o readable.html && wkhtmltopdf readable.html output.pdf && open output.pdf
going even further using bash script to prompt for url.
#!/bin/bash
# Prompt the user for a URL
read -p "Enter the URL: " URL
# Use the URL in the pandoc command
pandoc -s $url -o output.html && readable output.html -o readable.html && wkhtmltopdf readable.html output.pdf && open output.pdf
chmod +x web2pdf.sh
# add an alias to bashrc
alias web2pdf='/path/to/your/web2pdf.sh'
source ~/.bashrc
- natrys 3y agoPandoc can also output to pdf if you have latex installed. You can use tectonic if you want a single binary solution than a full latex toolchain, it downloads necessary packages on the fly.
- worldsayshi 3y agoPandoc can also do epub output: https://pandoc.org/epub.html https://pandoc.org/epub.html
- psanford 3y agowkhtmltopdf seems to be archived on github[1]. Can't say I want to run an unpatched, outdated browser engine for this. [1]: https://github.com/wkhtmltopdf/wkhtmltopdf https://github.com/wkhtmltopdf/wkhtmltopdf
- bananskalhalk 3y agoOr you could just import weasyprint and readability in python! Which is pretty much what OP did, with a few nice additions like nice output and some custom css and fonts. Which is nice and OP hope brings value to people. If you add a few printf:s and include a nice template for pandoc* it would be more along the same thing. *) Neither pandoc, wkhtmlpdf or weasyprint have (in my opinion) bad default templates.