Compiling wkhtmltopdf

Showing 1-9 of 9 messages
Compiling wkhtmltopdf Mark Thomson 6/25/12 9:04 AM
I'd like to try to compile wkhtmltopdf locally so I can take a closer look at some of the seg fault errors I've been getting. However when I try to follow the instructions here - http://code.google.com/p/wkhtmltopdf/wiki/compilation I get a lot of errors like this one -

../lib/pdfconverter_p.hh:97:50: error: class ‘wkhtmltopdf::PageObject’ does not have any field named ‘headerReserveHeight’

Looking at the source, it appears that the problem is that the preprocessor symbol __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ is not defined. 

When/how/where is this supposed to be defined?

Mark
Re: Compiling wkhtmltopdf Mark Thomson 6/25/12 10:18 AM
Ok so I added __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ to the defines in src/lib/Makefile, and that got me past the immediate hurdle, but now I've run into the stuff below.

Any advice? 

BTW, I'm on a linux mint box, and I went through the process of installing QT by hand as described in the instructions before trying to compile wkhtmltopdf.

----
make && make installcd src/lib/ && make -f Makefile 
make[1]: Entering directory `/home/mark/wkhtmltopdf/src/lib'
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_WEBKIT -DMAJOR_VERSION=0 -DMINOR_VERSION=10 -DPATCH_VERSION=0 -DBUILD=rc2 -DQT_SHARED -DBUILDING_DLL -D__WKHTMLTOX_UNDEF_QT_DLL__ -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_SVG_LIB -DQT_XMLPATTERNS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -D__EXTENSIVE_WKHTMLTOPDF_QT_HACK__ -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I../../include -I../../build -o ../../build/pdfconverter.o ../lib/pdfconverter.cc
In file included from ../lib/pdfconverter_p.hh:31:0,
                 from ../lib/pdfconverter.cc:27:
../lib/outline.hh:44:51: error: ‘QWebPrinter’ has not been declared
In file included from ../lib/pdfconverter_p.hh:31:0,
                 from ../lib/pdfconverter.cc:27:
../lib/outline.hh:45:40: error: ‘QWebPrinter’ has not been declared
In file included from ../lib/pdfconverter.cc:27:0:
../lib/pdfconverter_p.hh:137:2: error: ‘QWebPrinter’ does not name a type
../lib/pdfconverter_p.hh: In constructor ‘wkhtmltopdf::PdfConverterPrivate::PdfConverterPrivate(wkhtmltopdf::settings::PdfGlobal&, wkhtmltopdf::PdfConverter&)’:
../lib/pdfconverter_p.hh:162:12: warning: ‘wkhtmltopdf::PdfConverterPrivate::outline’ will be initialized after [-Wreorder]
../lib/pdfconverter_p.hh:140:13: warning:   ‘QWebPage* wkhtmltopdf::PdfConverterPrivate::currentHeader’ [-Wreorder]
../lib/pdfconverter.cc:77:1: warning:   when initialized here [-Wreorder]
../lib/pdfconverter.cc: In member function ‘qreal wkhtmltopdf::PdfConverterPrivate::calculateHeaderHeight(wkhtmltopdf::PageObject&, QWebPage&)’:
../lib/pdfconverter.cc:224:5: error: ‘QWebPrinter’ was not declared in this scope
../lib/pdfconverter.cc:224:17: error: expected ‘;’ before ‘wp’
../lib/pdfconverter.cc:225:20: error: ‘wp’ was not declared in this scope
../lib/pdfconverter.cc:220:27: warning: unused variable ‘s’ [-Wunused-variable]
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::preprocessPage(wkhtmltopdf::PageObject&)’:
../lib/pdfconverter.cc:271:2: error: ‘QWebPrinter’ was not declared in this scope
../lib/pdfconverter.cc:271:14: error: expected ‘;’ before ‘wp’
../lib/pdfconverter.cc:272:43: error: ‘wp’ was not declared in this scope
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::pagesLoaded(bool)’:
../lib/pdfconverter.cc:352:38: error: ‘PPK_UseCompression’ is not a member of ‘QPrintEngine’
../lib/pdfconverter.cc:353:38: error: ‘PPK_ImageQuality’ is not a member of ‘QPrintEngine’
../lib/pdfconverter.cc:354:38: error: ‘PPK_ImageDPI’ is not a member of ‘QPrintEngine’
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)’:
../lib/pdfconverter.cc:579:3: error: ‘QWebPrinter’ was not declared in this scope
../lib/pdfconverter.cc:579:15: error: expected ‘;’ before ‘wp’
../lib/pdfconverter.cc:580:25: error: ‘wp’ was not declared in this scope
../lib/pdfconverter.cc:587:13: error: ‘class QPainter’ has no member named ‘addLink’
../lib/pdfconverter.cc:591:13: error: ‘class QPainter’ has no member named ‘addHyperlink’
../lib/pdfconverter.cc:608:3: error: ‘QWebPrinter’ was not declared in this scope
../lib/pdfconverter.cc:608:15: error: expected ‘;’ before ‘wp’
../lib/pdfconverter.cc:615:15: error: ‘wp’ was not declared in this scope
../lib/pdfconverter.cc:616:13: error: ‘class QPainter’ has no member named ‘addLink’
../lib/pdfconverter.cc:619:15: error: ‘wp’ was not declared in this scope
../lib/pdfconverter.cc:620:13: error: ‘class QPainter’ has no member named ‘addHyperlink’
../lib/pdfconverter.cc:622:3: error: ‘wp’ was not declared in this scope
../lib/pdfconverter.cc: At global scope:
../lib/pdfconverter.cc:523:6: warning: unused parameter ‘objectPage’ [-Wunused-parameter]
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::handleTocPage(wkhtmltopdf::PageObject&)’:
../lib/pdfconverter.cc:633:2: error: ‘QWebPrinter’ was not declared in this scope
../lib/pdfconverter.cc:633:14: error: expected ‘;’ before ‘wp’
../lib/pdfconverter.cc:634:36: error: ‘wp’ was not declared in this scope
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::spoolPage(size_t)’:
../lib/pdfconverter.cc:738:2: error: ‘webPrinter’ was not declared in this scope
../lib/pdfconverter.cc:744:13: error: ‘class QPainter’ has no member named ‘addTextField’
../lib/pdfconverter.cc:754:13: error: ‘class QPainter’ has no member named ‘addCheckBox’
../lib/pdfconverter.cc:764:12: error: ‘class QPainter’ has no member named ‘addAnchor’
../lib/pdfconverter.cc:769:12: error: ‘class QPainter’ has no member named ‘addLink’
../lib/pdfconverter.cc:774:12: error: ‘class QPainter’ has no member named ‘addHyperlink’
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::spoolTo(size_t)’:
../lib/pdfconverter.cc:783:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::beginPrintObject(wkhtmltopdf::PageObject&)’:
../lib/pdfconverter.cc:816:2: error: ‘webPrinter’ was not declared in this scope
../lib/pdfconverter.cc:816:19: error: expected type-specifier before ‘QWebPrinter’
../lib/pdfconverter.cc:816:19: error: expected ‘;’ before ‘QWebPrinter’
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::endPrintObject(wkhtmltopdf::PageObject&)’:
../lib/pdfconverter.cc:859:10: error: ‘webPrinter’ was not declared in this scope
../lib/pdfconverter.cc:864:9: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
../lib/pdfconverter.cc: At global scope:
../lib/pdfconverter.cc:858:6: warning: unused parameter ‘obj’ [-Wunused-parameter]
../lib/pdfconverter.cc: In member function ‘void wkhtmltopdf::PdfConverterPrivate::printDocument()’:
../lib/pdfconverter.cc:894:24: error: ‘webPrinter’ was not declared in this scope
../lib/pdfconverter.cc:892:32: warning: unused variable ‘ps’ [-Wunused-variable]
make[1]: *** [../../build/pdfconverter.o] Error 1
make[1]: Leaving directory `/home/mark/PersuasiveThinking/Code/github_local_repos/wkhtmltopdf/src/lib'
make: *** [sub-src-lib-make_default-ordered] Error 2
Re: Compiling wkhtmltopdf Mark Thomson 6/25/12 2:43 PM
Hmm... there is a QWebPrinter class defined as part of wkhtmltopdf-qt (src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h). Are those files meant to be included in the compilation process? Would appreciate some help. 


On Monday, June 25, 2012 11:04:25 AM UTC-5, Mark Thomson wrote:
Re: [wkhtmltopdf-dev] Re: Compiling wkhtmltopdf Jakob Truelsen 6/27/12 6:55 AM
Hello. Yes you are suppose to use my version of qt, if you want all
the features.

For now use this branch
https://qt.gitorious.org/~antialize/qt/antializes-qt/commits/4.8.2, as
it works with wkhtmlopdf master, and is a never qt version. I am still
in the process of getting this new qt version working propperly,
currently there are still some issues with wkhtmltopdf running very
slowly with this new qt.

After checking out the qt branch, remember to run the bin/syncqt, then
run configure, you can exclude some stuff so the compilation will be
faster, but the default values are generally ok.  Remember to set the
-prefix though

/Jakob
> --
Re: [wkhtmltopdf-dev] Re: Compiling wkhtmltopdf Mark Thomson 6/27/12 2:07 PM
Thanks Jakob! It's all working fine now (The only very small issue was that I needed sudo on make install). The seg faults that I had previously been seeing with wkhtmltoimage seem to have been resolved as well.

Mark.
Re: [wkhtmltopdf-dev] Re: Compiling wkhtmltopdf Jakob Truelsen 6/28/12 12:07 AM
Yes in general, a non static build, like the one you just did, seems
work much better then a static build, however it is very platform
specific, and hard to distribute.

/Jakob
unk...@googlegroups.com 9/3/12 6:38 AM <This message has been deleted.>
unk...@googlegroups.com 9/3/12 7:19 AM <This message has been deleted.>
Re: [wkhtmltopdf-dev] Re: Compiling wkhtmltopdf Anjan - 1/24/13 12:47 AM
Hi Jakob,

Is there any way in which we can build a static binary now? I have posted to the group about the errors I am receiving: https://groups.google.com/forum/#!topic/wkhtmltopdf-dev/eDRiYdy2fRs. Regular compilation works. Just the static binary build fails.

I am sure a lot of people would appreciate being able to get a static build which can be transferred to other machines without having to recompile every time. Or else, once compiled on a machine, if you can just tell us which files are to be transferred to another machine for it to work, that would be a huge help as well.

Thanks.
Anjan