File: export_all_to_pdf.sh

package info (click to toggle)
paperwork 2.2.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 166,660 kB
  • sloc: python: 44,775; makefile: 992; sh: 625; xml: 135
file content (22 lines) | stat: -rwxr-xr-x 544 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash

if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
	echo "Convert all your Paperwork documents into PDF."
	echo "Requires 'paperwork-json', 'paperwork-cli' and GNU parallel."
	echo
	echo "Syntax:"
	echo "  $0 <output directory>"
	exit 1
fi

out_dir="$1"

mkdir -p "$out_dir"

for doc_id in $(paperwork-json search --limit 10000000 "" | jq -r ".[]") ; do
	echo paperwork-cli export ${doc_id} \
			-f automatic_pdf \
			-o "${out_dir}/${doc_id}.pdf"
done | parallel --halt now,fail=1 sh -c {}

echo "All done !"