Skip to content

Commit b2c9713

Browse files
committed
Add PDF option
1 parent c25fb1a commit b2c9713

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ Tested on a network EcoTank with the following command:
2424
./clogtank.sh EPSON_ET_2870_Series
2525
```
2626

27+
**If for some reason your CUPS will not print the jpeg directly,**
28+
you can give "pdf" as the second argument:
29+
```bash
30+
./clogtank.sh cups_printer_id_here pdf
31+
```
32+
33+
To use this, you will probably have to [allow PDF modifications in ImageMagick's security policy](https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion).
34+
2735
## Example of installation
2836
Run `crontab -e` to edit your Cron jobs.
2937
Then add the following line:
@@ -36,6 +44,13 @@ This will print a random page every 3 days at 15:00.
3644
**ImageMagick and Cups might work differently based on the installed version.**
3745
Go ahead and modify the script parameters for your need, if it doesn't work at first!
3846

47+
## Troubleshooting: Print as PDF instead of JPG?
48+
On my server, the jpeg does not get printed. The printer just wakes up and does nothing.
49+
Thus, there is the option to print the image as a pdf.
50+
51+
Just uncomment these lines:
52+
53+
3954
## What does it do?
4055

4156
Below is an example of the produced image.

clogtank.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,15 @@ done
8585
convert temp.png temp.jpg
8686
rm temp.png
8787

88+
8889
#
8990
# Print the file
9091
#
91-
lp -o fit-to-page -d $1 temp.jpg
92+
if [ $2 = "pdf" ]; then
93+
convert temp.jpg -auto-orient temp.pdf
94+
lp -d $1 temp.pdf
95+
else
96+
lp -o fit-to-page -d $1 temp.jpg
97+
fi
9298

9399
echo "All done! (I hope!)"

0 commit comments

Comments
 (0)