sudo apt-get install wkhtmltopdf
@@ 커맨드 모음
wkhtmltopdf --user-style-sheet ~/apps/wkhtmltopdf/font.css -s A4 --header-right "[webpage]" http://www.qtcentre.org/archive/index.php/t-51448.html ~/Documents/temp.pdf wkhtmltopdf --user-style-sheet ~/apps/wkhtmltopdf/font.css -s A4 --footer-left "[webpage]" http://askubuntu.com/questions/104695/how-do-i-change-mirrors-in-ubuntu-server-from-regional-to-main ~/Desktop/workspace/Prints/temp/temp.pdf wkhtmltopdf --no-outline -B 6mm -L 4mm -R 4mm -T 4mm --user-style-sheet font.css -s A4 --footer-font-size 8 --footer-line --footer-left "[webpage]" \ http://daum.net \ ~/Documents/temp.pdf wkhtmltopdf --user-style-sheet ~/apps/wkhtmltopdf/font.css -s A4 --footer-left "[webpage]" \ http://naver.com \ ~/Desktop/workspace/Prints/temp/temp.pdf wkhtmltopdf --no-outline -B 6mm -L 4mm -R 4mm -T 4mm --user-style-sheet font.css -s A4 --footer-font-size 8 --footer-line --footer-left "[webpage]" \ http://xmodulo.com/how-to-parse-json-string-in-perl.html \ ~/Documents/temp.pdf
@@ 변경 샘플
wkhtmltopdf --user-style-sheet font.css --ignore-load-errors http://daum.net/ naver.pdf
@@ 도움말 확인하기
wkhtmltopdf --extended-help
@@ CSS 적용
wkhtmltopdf --user-style-sheet font.css --ignore-load-errors http://localhost/~user1/test.html naver.pdf
@@ A4 용지 맞추기
wkhtmltopdf --user-style-sheet font.css -s A4 --ignore-load-errors http://localhost/~user1/test.html naver.pdf
@@ dpi를 지정해서 해결하는 방법
wkhtmltopdf --user-style-sheet font.css --dpi 75 --ignore-load-errors http://daum.net naver.pdf
UBUNTU 15.04에서 QT-4.8.4 기준으로 설치하는데 성공하였다.
라이브러리를 그대로 젠투로 가져가서 실행하려는데 에러가 발생하여 libpng1.2버전을 설치하니 해결되었다.
emerge =libpng-1.2.56
[ 필요없음 ] 만일 컴파일 완료된 프로그램을 다른 리눅스로 복사했을 경우 다음과 같이 라이브러리 패스를 맞춰준다.
export LD_LIBRARY_PATH=/home/ftc/apps/wkqt/lib:/home/ftc/apps/wkqt/lib/ mkdir /home/user1/apps cd /home/user1/apps sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev git-core libfontconfig1-dev libfreetype6-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev sudo apt-get install build-dep qt4-qmake apt-get install libxext-dev
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf git clone https://github.com/wkhtmltopdf/qt.git wkhtmltopdf-qt cd wkhtmltopdf-qt
[ 필요없음 ] git checkout 4.8.4
QTDIR 반드시 해줄것
QTDIR=. ./bin/syncqt
@@ 64비트에서 에러가 난다면 아래의 패키지를 설치해야 한다.
sudo apt-get install lib32stdc++6
./configure -no-multimedia -nomake "tools examples demos docs translations" -opensource -prefix ../wkqt make -j5 && make install # installing wkhtmltopdf cd ../wkhtmltopdf # now, run qmake in this directory: ../wkqt/bin/qmake # finally, make wkhtmltopdf (if you get permission errors, run make and make install as sudo) make sudo make install
user1@webterror:~/apps/wkhtmltopdf/bin$ cat ~/.profile export PATH=$PATH:/home/user1/apps/wkhtmltopdf/bin vi ~/apps/wkhtmltopdf/font.css
@@ CSS 파일을 생성해서 letter-spacing을 재정의 한다.
user1@webterror:~/Documents/sed_연습$ cat font.css
*,span { letter-spacing: 0px !important;}
@@ JSON 라이브러리 설치하기
apt-get install libjson-perl
wkhtmltopdf –user-style-sheet font.css -s A4 http://localhost/~user1/test.html naver.pdf
@@ URL 나오게 하기
wkhtmltopdf --user-style-sheet font.css -s A4 --header-right "[webpage]" http://localhost/~user1/test.html naver.pdf
user1@webterror:~/Documents/sed_연습$ cat ~/public_html/test.html
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
</head>
<body>
<div><span style=”font-family: ‘돋움’,dotum,sans-serif; text-decoration: underline; letter-spacing: -1px;”>배진원</span></div>
<div><span style=”font-family: ‘굴림’,gulim,sans-serif; letter-spacing: -1px;”>배진원</span></div>
<div><span style=”font-family: ‘NanumGothic’; letter-spacing: -1px;”>배진원</span></div>
<div><span style=”font-family: ‘백묵 바탕’; letter-spacing: -1px;”>배진원</span></div>
<div>PAGE1</div>
<div style=”page-break-after: always;”><span style=”display: none;”> </span></div>
<div>PAGE2</div>
</body>
</html>