MuPDF is a free and open-source document viewer. It is lightweight, fast, and supports various document formats such as PDF, XPS, OpenXPS, CBZ, EPUB, etc.
It consists of a software library, command-line tools, and viewers for various platforms which can be used to render and convert documents from one format to another.
In this article, I will discuss how to install MuPDF in Ubuntu.
Features of MuPDF
Some features of MuPDF viewer are –
- Small and fast
- Supports high-quality anti-aliased graphics renderer
- Supports multiple file formats
- It is extensible and features can be added if needed
- Provides searching tools
- Has command-line tool
How to install MuPDF in Ubuntu
The installation of MuPDF is very straight forward you simply need to use apt command to install it on your system.
Before running command to install MuPDF make sure to update apt package index on your system –
sudo apt update
And then install the following packages –
sudo apt install mupdf mupdf-tools
Press y and then enter if it ask you for your confirmation.
Here mupdf-tools
package is required to render and convert documents from one format to other.
Syntax of MuPDF command
The syntax of using MuPDF command is given below.
mupdf [options] file.pdf [page]
You can use the following options with mupdf command.
-p
– Used to open an encrypted pdf file
-r
– Changes the initial zoom level, specified as the resolution in dpi
-A
– Set anti-aliasing quality in bits (0=off, 8=best)
-C
– RRGGBB (tint color in hexadecimal syntax)
-W
– Page width for EPUB layout
-H
– Page height for EPUB layout
-I
– Invert colors of document
-S
– Adjust font size for EPUB layout
-U
– User style sheet for EPUB layout
-X
– Disable document styles for EPUB layout
Usage of mupdf command in Ubuntu
Some examples of using mupdf command in a Ubuntu system are given below.
Run the following command to open a pdf file –
mupdf google.pdf
This will display the content of file named google.pdf in a separate window.
By default this file opens in 96 dpi to open it in 150 dpi resolution use –
mupdf -r 150 google.pdf
This will display content as you can see it in the image below.
Using option -I with this command will invert the colour of document that you open.
mupdf -I google.pdf
You can see the output in the given image –
Similarly you can use other options with mupdf command to view modified ouptut.
Usage of mutool command in Ubuntu
Mutool command is very useful it allows us to perform tasks such as creating a pdf from text file, converting a file from one format to another, rewriting a pdf, merging two or more files in a single pdf, etc.
Some usage of mutool command are given below.
Create a pdf from text file –
mutool create -o output.pdf -O pretty file1.txt
Merge two pdf files into third one –
mutool merge -o output.pdf file1.pdf file2.pdf
Convert a input file to another format –
mutool convert -o output input
Where input and output file format can be any of the document formats supported by MuPDF i.e. PDF, XPS, CBZ, unprotected EPUB, FB2, etc.
Now you can find detailed syntax, options and usage of mutool command in its official documentation.
Conclusion
I hope now you understand how to install and use MuPDF in Ubuntu. Now if you have a query then write us in the comments below.