Last active
December 16, 2015 22:28
-
-
Save henix/5506743 to your computer and use it in GitHub Desktop.
convert a web page to pdf using [prince](http://www.princexml.com/) 8.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
font-family: "DejaVu Serif", "AR PL New Sung", "WenQuanYi Zen Hei", serif; | |
} | |
@page { | |
/*background-color: #C7EDCC;*/ | |
background-color: #CCB995; | |
margin: 1.5cm; | |
} | |
body { | |
line-height: 1.25; | |
font-size: 20pt; | |
color: #123; | |
} | |
img { | |
max-width: 100%; | |
} | |
pre { | |
white-space: pre-wrap; | |
} | |
p { | |
line-height: 1.8; | |
margin: 0.4em 0; | |
text-indent: 2em; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ $# -ne 2 ] && echo Usage: web2pdf.sh title url/path && exit 1 | |
if [ $(echo $1 | sed -n -e '/\//p' | wc -l) -gt 0 ]; then | |
echo title cannot contains \"/\" | |
exit 2 | |
fi | |
~/prince/bin/prince --no-author-style --style=/home/henix/web2pdf.css -i html5 -o "$1.pdf" "$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment