Browse Source

Merge branch '0.9'

Conflicts:
	README
	src/pageconverter.cc
	wkhtmltopdf.pro
Jakob Truelsen 15 years ago
parent
commit
99c3dafe1c
8 changed files with 261 additions and 163 deletions
  1. 9 1
      README
  2. 30 7
      scripts/release.sh
  3. 76 39
      scripts/static-build.sh
  4. 140 112
      scripts/test.sh
  5. 3 0
      src/pageconverter.cc
  6. 0 1
      static_qt_conf_linux
  7. 2 2
      wkhtmltopdf.nsi.m4
  8. 1 1
      wkhtmltopdf.pro

+ 9 - 1
README

@@ -1,4 +1,4 @@
-==========================> wkhtmltopdf 0.9.5 Manual <==========================
+==========================> wkhtmltopdf 0.9.6 Manual <==========================
 This file documents wkhtmltopdf, a program capable of converting html documents
 into PDF documents.
 
@@ -43,6 +43,8 @@ Bouthenot.
 wkhtmltopdf [OPTIONS]... <input file> [More input files] <output file>
 
 ==============================> General Options <===============================
+    --allow <path>                    Allow the file or files from the specified
+                                      folder to be loaded (repeatable)
 -b, --book *                          Set the options one would usually set when
                                       printing a book
     --collate                         Collate when printing multiple copies
@@ -65,15 +67,21 @@ wkhtmltopdf [OPTIONS]... <input file> [More input files] <output file>
     --disable-external-links *        Do no make links to remote web pages
     --disable-internal-links *        Do no make local links
 -n, --disable-javascript              Do not allow web pages to run javascript
+    --disable-pdf-compression *       Do not use lossless compression on pdf
+                                      objects
     --disable-smart-shrinking *       Disable the intelligent shrinking strategy
                                       used by WebKit that makes the pixel/dpi
                                       ratio none constant
+    --disallow-local-file-access      Do not allowed conversion of a local file
+                                      to read in other local files, unless
+                                      explecitily allowed with --allow
 -d, --dpi <dpi>                       Change the dpi explicitly (this has no
                                       effect on X11 based systems)
     --enable-plugins                  Enable installed plugins (such as flash
     --encoding <encoding>             Set the default text encoding, for input
     --extended-help                   Display more extensive help, detailing
                                       less common command switches
+    --forms *                         Turn HTML form fields into pdf form fields
 -g, --grayscale                       PDF will be generated in grayscale
 -h, --help                            Display help
     --htmldoc                         Output program html help

+ 30 - 7
scripts/release.sh

@@ -1,5 +1,26 @@
 #!/bin/bash
 
+function usage() {
+    echo "Usage $0: [Options] Major Minor Patch [Build]"
+    echo ""
+    echo "Options:"
+    echo "-h           Display this help message"
+    echo "-q           Build against this branch of QT"
+}
+
+while getopts hq: O; do
+    case "$O" in
+	[?h])
+	    usage;
+	    exit 1
+	    ;;
+	q)
+	    shift 2
+	    QB="-q $OPTARG"
+	    ;;
+    esac
+done
+
 git status
 if [[ $1 == "" ]] || [[ $2 == "" ]] || [[ $3 == "" ]]; then
 	echo "Bad version"
@@ -10,27 +31,29 @@ if [[ "$4" != "" ]]; then
     v="${v}_$4"
 fi
 
-echo "About to release $v" 
+echo "About to release $v"
 read -p "Are you sure you are ready: " N
 [ "$N" != "YES" ] && exit
 
 sed -ri "s/MAJOR_VERSION=[0-9]+ MINOR_VERSION=[0-9]+ PATCH_VERSION=[0-9]+ BUILD=.*/MAJOR_VERSION=$1 MINOR_VERSION=$2 PATCH_VERSION=$3 BUILD=\"$4\"/" wkhtmltopdf.pro || exit 1
 
-git commit -m "Making ready for version $v" wkhtmltopdf.pro
+HEAD="$(git log --pretty=oneline  -n 1 | sed -e 's/ .*//')"
+git commit -m "TEMPORERY DO NOT COMMIT $v" wkhtmltopdf.pro
 
 rm -rf wkhtmltopdf-i386 wkhtmltopdf-amd64 wkhtmltopdf.exe wkhtmltopdf
-./scripts/static-build.sh linux-i386 || (echo Build failed; exit 1)
+./scripts/static-build.sh $QB linux-i386 || (echo Build failed; git reset $HEAD --hard; exit 1)
 cp wkhtmltopdf-i386 wkhtmltopdf
-if ! ./scripts/test.sh; then
+if ! ./scripts/test.sh -q; then
 	echo "Test failed"
+	git reset $HEAD --hard
 	exit 1
 fi
 
 ./wkhtmltopdf-i386 --readme > README
-./scripts/static-build.sh linux-amd64 || (echo Build failed; exit 1)
-./scripts/static-build.sh windows || (echo Build failed; exit 1)
+./scripts/static-build.sh $QB linux-amd64 || (echo Build failed; git reset $HEAD --hard; exit 1)
+./scripts/static-build.sh $QB windows || (echo Build failed; git reset $HEAD --hard; exit 1)
 
-git commit -m "Making ready for version $v" README
+git commit --amend -m "Version $v" wkhtmltopdf.pro README
 git tag "$v"
 
 rm -rf "release-$v"

+ 76 - 39
scripts/static-build.sh

@@ -19,7 +19,6 @@
 
 #Configuration for the static build
 
-QT=qt-all-opensource-src-4.5.1
 MIRROR=kent
 MINGWFILES="binutils-2.19.1-mingw32-bin.tar.gz \
 mingw32-make-3.81-20090910.tar.gz \
@@ -32,6 +31,42 @@ GNUWIN32FILES="openssl-0.9.8h-1-lib.zip \
 openssl-0.9.8h-1-bin.zip "
 #freetype-2.3.5-1-bin.zip \
 #freetype-2.3.5-1-lib.zip "
+QTBRANCH=
+
+function usage() {
+	echo "Usage: $0 [OPTIONS] target"
+	echo ""
+	echo "Options:"
+	echo "-h            Display this help message"
+	echo "-q branch     Use this qt branch"
+	echo "-v version    Compile this version of wkhtmltopdf"
+	echo ""
+	echo "Target:"
+	echo "linux-local   Compile under local linux distro"
+	echo "linux-amd64   Compile under debian 64bit chroot"
+	echo "linux-i368    Compile under debian 32bit chroot"
+	echo "windows       Compile windows binary using wine"
+}
+VERSION=""
+QTBRANCH="staging"
+
+while getopts hq:v: O; do
+	case "$O" in
+		[h?])
+			usage
+			exit 1
+			;;
+		v)
+			shift 2
+			VERSION=$OPTARG
+			;;
+		q)
+			shift 2
+			QTBRANCH=$OPTARG
+			;;
+	esac
+done
+
 
 if file /bin/true | grep -q 64-bit; then
     UPX=upx-3.03-amd64_linux
@@ -39,7 +74,6 @@ else
     UPX=upx-3.03-i386_linux
 fi
 
-
 #Helper functions
 function get() {
     [ -f $2.download ] || (rm -rf $2; wget $1 -O $2 && touch $2.download)
@@ -48,16 +82,29 @@ function unpack() {
     [ -f $1.unpack ] || (echo "unpacking $1"; (tar -xf $1 || unzip -o $1) && touch $1.unpack)
 }
 
-function usage() {
-    echo "please specify what static binary you want build (linux, win or all)"
-    exit 1
-}
 
 BASE=${PWD}
 BUILD=${BASE}/static-build
 
 VERSION=$2
 
+function git_fetch_and_update() {
+    if [ ! -d "$1" ]; then
+	git clone "$2" "$1" || (rm -rf "$1" && return 1)
+    fi
+    cd "$1"
+    git fetch origin 
+    if ! (git checkout "$3" -f 2>/dev/null && git pull origin "$3" 2>/dev/null); then
+	git branch -a
+	git checkout origin/"$3" -f 2>/dev/null || return 1
+	git branch -D "$3" 2>/dev/null
+	git checkout origin/"$3" -b "$3" || return 1
+	git pull origin "$3" -f || return 1
+    fi
+    cd ..
+}
+
+
 function checkout() {
     #Create static build directory
     mkdir -p $BUILD
@@ -65,13 +112,8 @@ function checkout() {
     cd ${BUILD}
     #Fetch most recent version of qt
     echo "Updating qt from remote"
-    if [ ! -d qt ] ; then
-	git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git qt || (rm -rf qt && exit 1)
-    fi
-    cd qt
-    git checkout staging || exit 1
-    git pull || exit 1
-    cd ..
+	git_fetch_and_update qt git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git "$QTBRANCH" || exit 1
+	cd qt
     #Fetch and unpack upx
     get http://upx.sourceforge.net/download/${UPX}.tar.bz2 ${UPX}.tar.bz2 || exit 1
     unpack ${UPX}.tar.bz2 || exit 1
@@ -79,26 +121,20 @@ function checkout() {
 
 function setup_build() {
     echo "Updating QT"
-
-    [ -d qts ] || git clone ${BUILD}/qt qts || (rm -rf qts && exit 1)
+	git_fetch_and_update qts ${BUILD}/qt "$QTBRANCH" || exit 1
     cd qts
-    git checkout staging || exit 1
-    git pull || exit 1
     if ! [ -z "$VERSION" ] ; then
-	git checkout wkhtmltopdf-$VERSION || exit 1
+		git checkout wkhtmltopdf-$VERSION || exit 1
     fi
     touch conf
     cat ${BASE}/static_qt_conf_base ${BASE}/static_qt_conf_${1} | sed -re 's/#.*//' | sed -re '/^[ \t]*$/d' | sort -u > conf_new
-  
     cd ..
 
-    echo "Updating wkhtmltopdf"
-    [ -d wkhtmltopdf ] || git clone ${BASE} wkhtmltopdf || (rm -rf wkhtmltopdf && exit 1)
-    cd wkhtmltopdf
-    git checkout master || exit 1
-    git pull || exit 1
+    echo "$(cd ${BASE} && git branch --no-color | sed -nre 's/\* //p')"
+	git_fetch_and_update wkhtmltopdf "${BASE}" "$(cd ${BASE} && git branch --no-color | sed -nre 's/\* //p')" || exit 1
+	cd wkhtmltopdf
     if ! [ -z "$VERSION" ] ; then
-	git checkout "$VERSION" || exit 1
+		git checkout "$VERSION" || exit 1
     fi
     cd ..
     [ "$1" == "win" ] && return 
@@ -111,22 +147,24 @@ mkdir -p qt/lib
 
 cd qts
 
-if ! cmp conf conf_new; then
+function do_configure() {
    echo "Configuring QT"
    (yes yes | ./configure \`cat conf_new\` -prefix "\${HERE}/qt" && cp conf_new conf) || exit 1
+}
+
+if ! cmp conf conf_new; then
+  QTDIR=. bin/syncqt || exit 1
+  do_configure
 fi
     
 if ! make -j3 -q; then
    echo "Building QT"
-   make -j3 || exit 1
-   make install || exit 1
+   (make -j3 && make install) || (make distclean; do_configure && make -j3 && make install) || exit 1
 fi
 cd ../wkhtmltopdf
 
 echo "Building wkhtmltopdfe"
-../qt/bin/qmake || exit 1
-make clean || exit 1
-make -j3 || exit 1
+(../qt/bin/qmake && make -j3) || (make distclean; ../qt/bin/qmake && make -j3) || exit 1
 strip wkhtmltopdf || exit 1
 EOF
     chmod +x build.sh
@@ -194,15 +232,14 @@ EOF
     mkdir -p windows/drive_c/mingw
     cd windows/drive_c/mingw
     for file in ${MINGWFILES}; do
- 	get http://${MIRROR}.dl.sourceforge.net/sourceforge/mingw/${file} ${file} || exit 1
- 	unpack ${file} || exit 1
+ 		get http://${MIRROR}.dl.sourceforge.net/sourceforge/mingw/${file} ${file} || exit 1
+ 		unpack ${file} || exit 1
     done
     for file in ${GNUWIN32FILES}; do
-	get http://downloads.sourceforge.net/gnuwin32/${file} ${file} || exit 1
-	unpack ${file} || exit 1
+		get http://downloads.sourceforge.net/gnuwin32/${file} ${file} || exit 1
+		unpack ${file} || exit 1
     done
 
-
     cd ..
     setup_build win
     
@@ -216,11 +253,11 @@ EOF
     cd qts
     if ! cmp conf conf_new; then
 	QTDIR=. bin/syncqt || exit 1
-	(yes | wine configure.exe -I "C:\qts\include" -I "C:\mingw32\include\freetype2" `cat conf_new` -prefix "C:\qt"  && cp conf_new conf) || exit 1
+	(yes | wine configure.exe -I "C:\qts\include" -I "C:\mingw32\include\freetype2" `cat conf_new` -prefix "C:\qt" && cp conf_new conf) || exit 1
     fi
     if ! wine mingw32-make -j3 -q; then
-	wine mingw32-make -j3 || exit 1
-	wine mingw32-make install || exit 1
+		wine mingw32-make -j3 || exit 1
+		wine mingw32-make install || exit 1
     fi
 
     cd ../wkhtmltopdf

+ 140 - 112
scripts/test.sh

@@ -16,227 +16,255 @@
 
 #This script will test a compiled wkhtmltopdf for some basic functionality
 
-#This is just some random image
-img=http://madalgo.au.dk/img/Forside/KatrinebjMay-05.jpg
-[ -d test ] || mkdir test
-cd test
-
-[ -f img.jpg ] || wget $img -O img.jpg
-
-
-export WK=../wkhtmltopdf 
-failed=0
-
 function result() { printf "%-30s [%-4s]\n" "$1" "$2";}
 function good() { result "$1" " OK ";}
 function bad() { result "$1" "Fail"; [ "$2" != "false" ] && export failed=$(($failed+1));}
 function fs() { du -b "$1" | sed -re 's/([0-9]*).*/\1/';}
-function wk() { $WK -q $*;}
+function wk() { $WK -q "$@"; }
+
+function testTest() {
+    (which pdftotext > $LEVEL1 && which pdfinfo > $LEVEL1) && good $1 || bad $1
+}
 
 #Test if we can convert a html file containing
 #An image of some format
-function testImgSupport() {
+function doTestImgSupport() {
     [ -f img.$1 ] || convert img.jpg img.$1
     rm -rf tmp.pdf
     echo "<html><head><title>Img test $1</title></head><body><h1>The $1 image</h1><img src=\"img.$1\" /></body></html>" > tmp.html
-    wk tmp.html tmp.pdf
+    wk tmp.html tmp.pdf 2>$LEVEL2 >$LEVEL1
     S=`fs tmp.pdf`
     ([ -f tmp.pdf ] && [[ $S -ge 20000 ]]) && good "$1 Suppport ($S)" || bad "$1 Support ($S)" "$2"
 }
 
-#Test if we can convert a local file, and that it has some of the right words
-function testLocalFileSupport() {
-    rm -rf tmp.pdf
+function testJPEGSupport() {
+    doTestImgSupport jpg true
+}
+
+function testGIFSupport() {
+    doTestImgSupport gif true
+}
+
+function testPNGSupport() {
+    doTestImgSupport png true
+}
+
+function testMNGSupport() {
+    doTestImgSupport mng false
+}
+
+function testTIFFSupport() {
+    doTestImgSupport tiff false
+}
+
+function testLocalFile() {
     echo "<html><head><title>Local Test</title></head><body><h1>Hello</h1></body></html>" > tmp.html
-    wk tmp.html tmp.pdf
-    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good LocalFile || bad LocalFile
+    wk tmp.html tmp.pdf 2>$LEVEL2 >$LEVEL1
+    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1
 }
 
 function testUserStyleSheet {
-    rm -f tmp.pdf tmp.html tmp.css
     echo "<html><head><title>Local Test</title></head><body><p>.</p></body></html>" > tmp.html
     echo "p:before {content: \"Hello \"}" > tmp.css
-    wk tmp.html tmp.pdf --user-style-sheet tmp.css
-    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good UserStyle || bad UserStyle "$1"
+    wk tmp.html tmp.pdf --user-style-sheet tmp.css 2>$LEVEL2 >$LEVEL1
+    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1 false
 }
 
-function testPipeInSupport() {
+function testPipeIn() {
     rm -rf tmp.pdf
     echo "<html><head><title>Local Test</title></head><body><h1>Hello</h1></body></html>" > tmp.html
-    cat tmp.html | wk - tmp.pdf
-    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good PipeInFile || bad PipeInFile
+    cat tmp.html | wk - tmp.pdf 2>$LEVEL2 >$LEVEL1
+    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1
 }
 
 function testPipeOutSupport() {
-    rm -rf tmp.pdf
     echo "<html><head><title>Local Test</title></head><body><h1>Hello</h1></body></html>" > tmp.html
-    wk tmp.html - > tmp.pdf
-    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good PipeOutFile || bad PipeQutFile
+    wk tmp.html - > tmp.pdf  2>$LEVEL2
+    ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1
 }
 
-#Test if we can convert a remove site.
 function testRemote() {
-    rm -rf tmp.pdf
-    wk http://www.google.dk/ tmp.pdf
-    [ -f tmp.pdf ] && good Remote || bad Remote
+    wk http://www.google.dk/ tmp.pdf 2>$LEVEL2 >$LEVEL1
+    [ -f tmp.pdf ] && good $1 || bad $1
 }
 
-#Test if we support SSL based sites
 function testSSL() {
-    rm -rf tmp.pdf
-    wk https://www.google.com/accouts tmp.pdf
-    [ -f tmp.pdf ] && good SSL || bad SSL
+    wk https://www.google.com/accouts tmp.pdf 2>$LEVEL2 >$LEVEL1
+    [ -f tmp.pdf ] && good $1 || bad $1
 }
 
-#Test if the header footer stuff works
 function testHeaderFooter() {
-    rm -rf tmp.pdf
     echo "<html><head><title>Local Test</title></head><body><h1>monster</h1></body></html>" > tmp.html
-    wk tmp.html tmp.pdf --footer-left hat --header-right emacs
+    wk tmp.html tmp.pdf --footer-left hat --header-right emacs 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
 	pdftotext tmp.pdf /dev/stdout | grep -q monster &&
 	pdftotext tmp.pdf /dev/stdout | grep -q emacs &&
-	pdftotext tmp.pdf /dev/stdout | grep -q hat) && good HeaderFooter || bad HeaderFooter
+	pdftotext tmp.pdf /dev/stdout | grep -q hat) && good $1 || bad $1
 }
 
 function testToc() {
     echo "<html><head></head><body><h1>foo</h1><h2>bar</h2><h3>baz</h3></body>" > tmp.html
-    wk tmp.html tmp.pdf --toc --toc-depth 2
+    wk tmp.html tmp.pdf --toc --toc-depth 2 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
 	[ "$(pdftotext tmp.pdf /dev/stdout | grep -c foo)" == 2 ] &&
 	[ "$(pdftotext tmp.pdf /dev/stdout | grep -c bar)" == 2 ] &&
-	[ "$(pdftotext tmp.pdf /dev/stdout | grep -c baz)" == 1 ]) && good Toc || bad Toc 
+	[ "$(pdftotext tmp.pdf /dev/stdout | grep -c baz)" == 1 ]) && good $1 || bad $1
 }
 
 
 function testOutline() {
-    rm -rf tmp.df
     echo "<html><head></head><body><h1>foo</h1><h2>bar</h2><h3>baz</h3></body>" > tmp.html
-    wk tmp.html tmp.pdf --outline --outline-depth 2
+    wk tmp.html tmp.pdf --outline --outline-depth 2 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
 	cat tmp.pdf | grep -q ".f.o.o" &&
 	cat tmp.pdf | grep -q ".b.a.r" &&
-	! cat tmp.pdf | grep -q ".b.a.z") && good Outline || bad Outline
+	! cat tmp.pdf | grep -q ".b.a.z") && good $1 || bad $1
 }
 
 function testJSRedirect() {
-    wk http://madalgo.au.dk/~jakobt/jsredirect.html tmp.pdf
+    wk http://madalgo.au.dk/~jakobt/jsredirect.html tmp.pdf 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
-	pdftotext tmp.pdf /dev/stdout | grep -q Right) && good JSRedicet || bad JSRedirect
+	pdftotext tmp.pdf /dev/stdout | grep -q Right) && good $1 || bad $1
 }
 
 function testServersideRedirect() {
-    wk http://madalgo.au.dk/~jakobt/redirect.php tmp.pdf
+    wk http://madalgo.au.dk/~jakobt/redirect.php tmp.pdf 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
-	pdftotext tmp.pdf /dev/stdout | grep -q Right) && good ServersideRedicet || bad ServersideRedirect
+	pdftotext tmp.pdf /dev/stdout | grep -q Right) && good $1 || bad $1
 }
 
 function test404() {
-    wk http://madalgo.au.dk/~jakobt/nosuchfile.nsf tmp.pdf && bad 404 || good 404
+    wk http://madalgo.au.dk/~jakobt/nosuchfile.nsf tmp.pdf 2>$LEVEL2 >$LEVEL1 && bad $1 || good $1
 }
 
 function testBadDest() {
     echo "<html><head></head><body><h1>foo</h1><h2>bar</h2><h3>baz</h3></body>" > tmp.html
-    (! wk tmp.html /proc/cpuinfo 2> tmp.out && grep -q "Error" tmp.out) && good BadDest || bad BadDest
+    (! wk tmp.html /proc/cpuinfo 2> tmp.out >$LEVEL1 && grep -q "Error" tmp.out) && good $1 || bad $1
 }
 
 function testBadSource() {
-    (! wk http://nosuchdomain.nosuchtld tmp.pdf 2> tmp.out && grep -q "Error" tmp.out) && good BadSource || bad BadSource
+    (! wk http://nosuchdomain.nosuchtld tmp.pdf 2> tmp.out && grep -q "Error" tmp.out) && good $1 || bad $1
 }
 
-function testMultidoc() {
-    rm -rf tmp.pdf
+function testMultipleInputDocuments() {
     echo "<html><head><title>Local Test</title></head><body><h1>Hello</h1></body></html>" > tmp.html
     echo "<html><head><title>Local Test</title></head><body><h1>world</h1></body></html>" > tmp2.html
-    wk tmp.html tmp2.html tmp.pdf
+    wk tmp.html tmp2.html tmp.pdf 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
 	pdftotext tmp.pdf /dev/stdout | grep -q Hello &&
-	pdftotext tmp.pdf /dev/stdout | grep -q world) && good MultiDoc || bad MultiDoc
+	pdftotext tmp.pdf /dev/stdout | grep -q world) && good $1 || bad $1
 }
 
 function testHtmlHeader() {
     echo "<html><body>Header</body></html>" > tmp.html
     echo "<html><head><title>Local Test</title></head><body><h1>world</h1></body></html>" > tmp2.html
-    wk --header-html tmp.html tmp2.html tmp.pdf
+    wk --header-html tmp.html tmp2.html tmp.pdf 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
 	pdftotext tmp.pdf /dev/stdout | grep -q Header &&
-	pdftotext tmp.pdf /dev/stdout | grep -q world) && good HtmlHeader || bad HtmlHeader
+	pdftotext tmp.pdf /dev/stdout | grep -q world) && good $1 || bad $1
 }
 
 function testCustomHeader() {
-    wk http://madalgo.au.dk/~jakobt/cookiewrite.php --custom-header "Cookie" "cookie=hello" tmp.pdf
+    wk http://madalgo.au.dk/~jakobt/cookiewrite.php --custom-header "Cookie" "cookie=hello" tmp.pdf 2>$LEVEL2 >$LEVEL1
     ([ -f tmp.pdf ] && 
-	pdftotext tmp.pdf /dev/stdout | grep -q hello) && good CustomHeader || bad CustomHeader
+	pdftotext tmp.pdf /dev/stdout | grep -q hello) && good $1 || bad $1
 }
 
 function testCookies() {
-    rm -rf tmp.jar tmp.pdf tmp2.pdf
-    wk --cookie mykey myvalue1 --cookie mykey2 myvalue2 --cookie-jar tmp.jar http://cs.au.dk/~jakobt/cookie.php tmp.pdf
-    wk --cookie-jar tmp.jar http://cs.au.dk/~jakobt/cookie.php tmp2.pdf
+    wk --cookie mykey myvalue1 --cookie mykey2 myvalue2 --cookie-jar tmp.jar http://cs.au.dk/~jakobt/cookie.php tmp.pdf 2>$LEVEL2 >$LEVEL1
+    wk --cookie-jar tmp.jar http://cs.au.dk/~jakobt/cookie.php tmp2.pdf 2>$LEVEL2 >$LEVEL1
     (   [ -f tmp.pdf ] &&
 	pdftotext tmp.pdf /dev/stdout | grep -q "mykey:myvalue1;" &&
 	pdftotext tmp.pdf /dev/stdout | grep -q "mykey2:myvalue2;" &&
 	[ -f tmp2.pdf ] &&
 	pdftotext tmp2.pdf /dev/stdout | grep -q "writetest:success;") &&
-    good Cookies || bad Cookies
+    good $1 || bad $1
 }
 
+function testTitle() {
+    title="\()fooæøåおさか おかみ"
+    wk http://google.com --title "$title" tmp.pdf 2>$LEVEL2 >$LEVEL1
+    ([ -f tmp.pdf ] && [[ "$(pdfinfo tmp.pdf  | sed -nre 's/Title:[\t ]*//p')" == "$title" ]]) && good $1 || bad $1
+}
 
-function testBuild() {
-    rm -rf wkhtmltopdf
-    (cd .. && git checkout-index --prefix=./test/wkhtmltopdf/ -a) || (bad "Build $1 (1)" && return 1)
+
+function testQMakeBuild() {
+    (cd .. && git checkout-index --prefix=./test/wkhtmltopdf/ -a) || (bad "$1 (1)" && return 1)
     cd wkhtmltopdf
-    if [[ "$1" == "qmake" ]]; then
-	qmake 2>/dev/null >/dev/null || (bad "Build $1 (2)" && return 1)
-    else
-	cmake . 2>/dev/null >/dev/null || (bad "Build $1 (2)" && return 1)
-    fi
-    make -j2 >/dev/null 2>/dev/null && good "Build $1" || bad "Build $1 (3)"
+    qmake 2>$LEVEL2 >$LEVEL1 || (bad "$1 (2)" && return 1)
+    make -j2 2>$LEVEL2 >$LEVEL1 || good $1 || bad $1
     cd ..
 }
 
-function testNoneStatic() {
-    ([ -f wkhtmltopdf/wkhtmltopdf ] && echo "<html><body>Foo</body></html>" | wkhtmltopdf/wkhtmltopdf -q - tmp.pdf && pdftotext tmp.pdf /dev/stdout | grep -q Foo) && good "None Static" || bad "None Static"
-}
-
-function testAgsFrmStdin() {
+function testArgumentFromStdin() {
     echo "<html><body>XFooZ</body></html>" > tmp.html
-    wk --read-args-from-stdin <<EOF
+    wk --read-args-from-stdin 2>$LEVEL2 >$LEVEL1 <<EOF
 -q tmp.html tmp1.pdf
 -q tmp.html tmp2.pdf
 EOF
     (   [ -f tmp1.pdf ] && pdftotext tmp1.pdf /dev/stdout | grep -q XFooZ &&
-	[ -f tmp2.pdf ] && pdftotext tmp2.pdf /dev/stdout | grep -q XFooZ) && good "Args from stdin" || bad "Arg from stdin"
-}
-
-good TestTest
-testCookies
-testLocalFileSupport
-testPipeInSupport
-testPipeOutSupport 
-testUserStyleSheet false
-testToc
-testOutline
-testImgSupport jpg true
-testImgSupport gif true
-testImgSupport png true
-testImgSupport mng false
-testImgSupport tiff false
-testJSRedirect
-testServersideRedirect
-test404
-testBadDest
-testBadSource
-testMultidoc
-testHtmlHeader
-testCustomHeader
-testRemote 
-testSSL
-testHeaderFooter
-testBuild qmake
-#testNoneStatic
-testAgsFrmStdin
-#testBuild cmake
-#Lets clean up
-rm -rf *.pdf *.html wkhtmltopdf
+	[ -f tmp2.pdf ] && pdftotext tmp2.pdf /dev/stdout | grep -q XFooZ) && good $1 || bad $1
+}
+
+function usage() {
+    echo "Usage $0 [OPTIONS] [EXPRESSION]"
+    echo ""
+    echo "Options:"
+    echo "-h         Display this message"
+    echo "-v         Be more verbose"
+    echo "-q         Be more quiet"
+    echo "-w path    wkhtmltopdf binary to test"
+    echo ""
+    echo "Expression:"
+    echo "grep regular expresion on what tests to run"
+}
+
+LEVEL1=/dev/null
+LEVEL2=/dev/stdout
+LEVEL3=/dev/stdout
+
+export WK=../wkhtmltopdf 
+
+while getopts hvqw: O; do
+    case "$O" in
+	[h?])
+	    usage
+	    exit 1
+	    ;;
+	v)
+	    shift 1
+	    LEVEL1=/dev/stdout
+	    ;;
+	q)
+	    shift 1
+	    LEVEL2=/dev/null
+	    ;;
+	w)
+	    shift 2
+	    export WK=$OPTARG
+	    ;;
+    esac
+done
+R=$1
+if [ -z "$R" ]; then 
+    R=.*
+fi
+
+TESTS=$(cat $0 | sed -nre 's/^function test(.*)\(\)\ \{.*/\1/p' | grep "$R");
+
+#This is just some random image
+img=http://madalgo.au.dk/img/Forside/KatrinebjMay-05.jpg
+[ -d test ] || mkdir test
+cd test
+[ -f img.jpg ] || wget $img -O img.jpg
+
+failed=0
+
+TMPFILES="tmp.pdf tmp.html tmp.css tmp2.html tmp.jar tmp1.pdf tmp2.pdf wkhtmltopdf/"
+
+for test in $TESTS; do
+    rm -rf $TMPFILES
+    eval test$test $test
+done
+rm -rf $TMPFILES
 exit $failed 

+ 3 - 0
src/pageconverter.cc

@@ -231,10 +231,13 @@ void PageConverterPrivate::preparePrint(bool ok) {
 
 #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__
 	//If you do not have the hacks you get this crappy solution
+
 	printer->setCollateCopies(settings.copies);
 	printer->setCollateCopies(settings.collate);
 	printPage(true);
 #else
+	printer->printEngine()->setProperty(QPrintEngine::PKK_UseCompression, settings.useCompression);
+
 	painter = new QPainter();
 	
 	QString title = settings.documentTitle;

+ 0 - 1
static_qt_conf_linux

@@ -34,6 +34,5 @@
 -no-openvg
 -no-opengl
 -no-xsync
--no-javascript-jit
 -no-svg
 

+ 2 - 2
wkhtmltopdf.nsi.m4

@@ -49,7 +49,7 @@ Section
                    "DisplayName" "wkhtmltopdf"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
                    "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
-  ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR" 
+;  ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR" 
 SectionEnd
 
 
@@ -61,7 +61,7 @@ Section "Uninstall"
   Delete "$INSTDIR\libgcc_s_dw2-1.dll"
   Delete "$INSTDIR\ssleay32.dll"
   Delete "$INSTDIR\libeay32.dll"
-
+;  ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR"
   Delete "$INSTDIR\uninstall.exe"
   RMDir "$INSTDIR"
   DeleteRegKey /ifempty HKCU "Software\wkhtmltopdf"

+ 1 - 1
wkhtmltopdf.pro

@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with wkhtmltopdf.  If not, see <http:#www.gnu.org/licenses/>.
 
-DEFINES += MAJOR_VERSION=0 MINOR_VERSION=9 PATCH_VERSION=5 BUILD=""
+DEFINES += MAJOR_VERSION=0 MINOR_VERSION=9 PATCH_VERSION=6 BUILD=""
 
 TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl
 PRL  = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl