Avoiding converter websites with linux utilities
Published at Oct 17, 2023
Utility list
Below are the links to the command-not-found
page, which gives a quick install and usage guide for each of the commands
command | usage |
---|---|
jupyter nbconvert |
Convert jupyter notebooks almost anything |
pandoc |
Convert almost anything almost anything |
pdfunite |
Combine pdfs |
Below are some of the expanded explanations on how to install and use the utility, refer to this if the above websites are insufficient.
If there are anymore utilities which you think are useful then feel free to contact me and I will add them to the list!
to pdf
.ipynb
.pdf
If you want just the command, and assuming you have the jupyter
installed here you go :
jupyter nbconvert --to FORMAT notebook.ipynb
To fully get this working you need to have jupyter
installed, and to install this you need to have the python package manager pip. To install all of this you should be able to run the following commands:
sudo apt install python3
sudo apt install python3-pip
sudo pip3 install --upgrade pip
pip install jupyter
Note - I tested the install commands only for ubuntu, so they might not work for your distro, but once you have jupyter
installed it should work all the same.
.md
/ .txt
.pdf
For this one there is a chance you don’t have the deps so the command for these is
sudo apt install
pandoc
texlive-latex-base
texlive-fonts-recommended
texlive-extra-utils
texlive-latex-extra
texlive-xetex
To then convert a markdown or txt file run the following
pandoc txtdoc.txt -o txtdoc.pdf -V geometry:margin=1in
pandoc mddoc.md -o mddoc.pdf -V geometry:margin=1in
The default margin is somewhat absurdly large so thats why I added the additional margin option
Note - pandoc actually has alot of different conversions if you need something more specific converted so its a really nice utility to have
combining pdf
If you want to combine multiple .pdf
’s into one you can use pdfunite
as follows
To install the deps
sudo apt-get install poppler-utils
To combine multiple pdfs into one
pdfunite path/to/fileA.pdf path/to/fileB.pdf path/to/merged_output.pdf