Skip to content

Commit

Permalink
Merge pull request #11 from apankowski/feature/minified-bookmark
Browse files Browse the repository at this point in the history
Bookmark for automatic download
  • Loading branch information
apankowski authored Oct 29, 2023
2 parents c664289 + 88e230c commit 132a7d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Possible options:
4. `quality` – quality of images; applicable when `format` is `'jpg'`; number between `0` and `1`; default is `0.9`
5. `imageNamePrefix` – prefix for names of downloaded images; string; default is `'page'` (resulting in downloaded file names e.g.: `page001.jpg`, `page002.jpg`, etc. assuming `format` is `'jpg'`)

### Bookmark

Create a browser bookmark pasting content of [this file](bookmark.min.js) (exactly as it is) in the URL field.

From now on, clicking it on a document page will download all pages as JPEGs.

## Converting downloaded images back to a PDF

Under Linux you can easily convert downloaded images back to a PDF.
Expand All @@ -51,3 +57,7 @@ Under Linux you can easily convert downloaded images back to a PDF.
### Troubleshooting

If you see errors from ImageMagick with the message "attempt to perform an operation not allowed by the security policy 'PDF'", see [this StackOverflow question](https://stackoverflow.com/q/52998331/1820695) and answers for a likely quick fix.

## Developing

1. Run `build-bookmark.sh` to update minified bookmark code in `bookmark.min.js`.
1 change: 1 addition & 0 deletions bookmark.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions build-bookmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euE
set -o pipefail

input=downloadPages.js
output=bookmark.min.js

echo -n "javascript:" > $output
uglifyjs <<< "$(cat "$input"; echo "downloadPages()")" >> $output

0 comments on commit 132a7d1

Please sign in to comment.