diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-05-05 20:56:37 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-05-22 08:44:19 +0530 |
commit | 21ee3489c29236a9197b6746f97f1c9f81bd0a48 (patch) | |
tree | a45e88d21c4d0af0841f02b7915c9d3ca83ef115 /plugins | |
parent | b764055314ac281206f370d49e49ee9faf8b24e7 (diff) | |
download | nnn-21ee3489c29236a9197b6746f97f1c9f81bd0a48.tar.gz |
Add pdfview to view PDF file in PAGER
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/README.md | 1 | ||||
-rwxr-xr-x | plugins/pdfview | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/plugins/README.md b/plugins/README.md index 544d2b8..5bd213a 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -13,6 +13,7 @@ | nmount | sh | pmount | Toggle mount status of a device as normal user | | nwal | sh | nitrogen | Set the selected image as wallpaper using nitrogen | | pastebin | sh | [pastebinit](https://launchpad.net/pastebinit) | Paste contents of current (text) file to paste.ubuntu.com | +| pdfview | sh | pdftotext, `$PAGER` | View current PDF file | | picker | sh | nnn | Pick files and pipe the newline-separated list to another utility | | pywal | sh | pywal | Set selected image as wallpaper, change terminal color scheme | | sxiv | sh | sxiv | Browse images in a dir in sxiv, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts))| diff --git a/plugins/pdfview b/plugins/pdfview new file mode 100755 index 0000000..20884d4 --- /dev/null +++ b/plugins/pdfview @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# Description: View a PDF file in pager +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if ! [ -z "$1" ]; then + if [ $(head -c 4 "$1") = "%PDF" ]; then + pdftotext -nopgbrk -layout "$1" - | sed 's/\xe2\x80\x8b//g' | $PAGER + fi +fi |