qpdfview is a lightweight PDF viewer that is popular among Linux users. It offers a range of display options that allow you to customize your viewing experience. In this article, we will explore how to set qpdfview display options in a Bash script, making it easier for you to automate and customize your PDF viewing.
Before we dive into the details, make sure you have qpdfview installed on your Linux system. You can install it by running the following command in your terminal:
sudo apt-get install qpdfview
Setting Display Options
qpdfview provides a set of command-line options that you can use to customize its display. These options can be passed as arguments when launching qpdfview from a Bash script. Let's take a look at some of the commonly used display options:
--page-layout: Specifies the initial page layout. You can set it to 'single' (default), 'continuous', or 'continuous-facing'. For example, to set the initial page layout to continuous-facing, use the following command:--zoom: Sets the initial zoom level. You can specify it as a percentage or use predefined values like 'fit-width', 'fit-height', or 'fit-page'. For example, to set the initial zoom level to fit-width, use the following command:--rotation: Specifies the initial page rotation. You can set it to '0' (default), '90', '180', or '270'. For example, to set the initial page rotation to 90 degrees, use the following command:--invert-colors: Inverts the colors of the PDF document for better readability. Use the following command to enable this option:
qpdfview --page-layout continuous-facing
qpdfview --zoom fit-width
qpdfview --rotation 90
qpdfview --invert-colors
These are just a few examples of the display options available in qpdfview. You can explore more options by referring to the qpdfview documentation or running qpdfview --help in your terminal.
Creating a Bash Script
Now that we know how to set qpdfview display options, let's create a Bash script to automate the process. Open a text editor and create a new file with a .sh extension, for example, qpdfview_options.sh.
Start by adding the shebang line at the top of the file:
#!/bin/bash
Next, you can use the qpdfview command with the desired display options. For example, to set the initial page layout to continuous-facing and the zoom level to fit-width, add the following lines to your script:
qpdfview --page-layout continuous-facing --zoom fit-width
You can add more options or customize the existing ones according to your preferences.
Save the file and exit the text editor. Make the script executable by running the following command in your terminal:
chmod +x qpdfview_options.sh
Now, you can run the script by executing the following command:
./qpdfview_options.sh
qpdfview will launch with the specified display options, providing you with a customized PDF viewing experience.
Conclusion
In this article, we explored how to set qpdfview display options in a Bash script. By using the command-line options provided by qpdfview, you can automate and customize your PDF viewing experience. Feel free to experiment with different options and create your own personalized PDF viewer.
References
| Reference | Link |
|---|---|
| qpdfview Documentation | https://launchpad.net/qpdfview |