Code Monkey home page Code Monkey logo

o-html2pdf's Introduction

WkHtmlToPDF

Check Publish Nightly

Warning

This not ready for production use yet, here be dragons!

Important

This is a fork of the original wkhtmltopdf project tailored for use with Odoo. It is not intended for general use. If you are looking for the original project, please see https://github.com/wkhtmltopdf/wkhtmltopdf

wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webkit rendering engine. These run entirely "headless" and do not require a display or display service.

See https://wkhtmltopdf.org for updated documentation.

Changes

Since this fork doesn't need to follow upstream QT and WebKit, we have made the following opinionated changes:

  • Greatly reduced the amount of style recomputations and layout passes which improves performances by 50% in most cases
  • Disabled bearer networking because it caused file descriptor leaks
  • Merge everything into a single repository, including the patched QT
  • In general, everything that is not needed by wkhtmltopdf has been removed from QT
  • Removed support for DSA since it is deprecated in OpenSSL and breaks the build on archlinux
  • Switched to build system to CuteKit instead of the hand-rolled one
  • Greatly improved tooling and build system with support for CPU and memory profiling

Roadmap

The long term goal is to make wkhtmltopdf as lean as possible and improve speed and stability. This will be done by:

  • Slim down QT even further and keep the bare minimum for rendering and networking
  • Remove the need for X11 and OpenGL
  • Slim down WebKit and keep the bare minimum for parsing and rendering HTML
  • Implement an area allocator to reduce memory fragmentation and improve cache locality when building the DOM and CSS Box Tree with the aim of improving performance and reducing memory usage
  • Add support for more recent versions of CSS and HTML
  • Remove support for JavaScript (?)

Building

$ ./bootstrap.sh tools setup

$ ./bootstrap.sh wk configure

$ ./bootstrap.sh wk build

License

LGPL License

WkHtmlToPDF is licensed under the LGPL License.

The full text of the license can be accessed via this link and is also included in the license.txt file of this software package.

o-html2pdf's People

Contributors

ashkulz avatar antialize avatar sleepy-monax avatar pruiz avatar npinchot avatar pussbb avatar sodabrew avatar a-ctor avatar theirix avatar tomsgu avatar rdvojmoc avatar poizan42 avatar bsinky avatar frenkel avatar trvrnrth avatar dmlambea avatar peterrehm avatar sanderkleykens avatar ro0gr avatar sormy avatar renan avatar uuf6429 avatar skennedy avatar stweil avatar unlimitedsola avatar esemi avatar icnocop avatar jangid avatar cub-uanic avatar nicovogel avatar

Stargazers

 avatar Artem avatar Z.X avatar Osman Bowser avatar Undead avatar Andy Fan avatar Gaspard d'Hautefeuille avatar H avatar 4535992 avatar Hao Xi avatar  avatar Thomas Petrou avatar Shinsuke Kurata avatar  avatar  avatar Carouan  avatar Huang Fusyong avatar Hamza BENZAOUI avatar  avatar Stanislav Lazarov avatar Thibault Junin avatar Keyboard Slayer avatar  avatar Rafael Gomes avatar Sunjae Kim avatar  avatar Ivan avatar Dylan Kiss avatar Ahmed Aly avatar Lê Anh Tuấn avatar Lars Liedtke avatar Arthur Gossuin avatar Yves Goldberg avatar Sambo Chea avatar Javier AG avatar Roger avatar Helmut Drewes avatar Rafnix Guzman avatar Usman Farzand avatar sesn-odoo avatar Takashi Iida avatar Raffael Meyer avatar

Watchers

Yves Goldberg avatar Rafael Gomes avatar Yoshi Tashiro (Quartile) avatar Usman Farzand avatar Stanislav Lazarov avatar  avatar Sunjae Kim avatar Arthur Gossuin avatar Eugene Molotov avatar Javier AG avatar  avatar Sinisa avatar  avatar

o-html2pdf's Issues

FreeBSD 14 - core dump during build

FreeBSD 14-RELEASE

When running bootstrap.sh wk build, it throws a core dump at the very end when performing the install_man install procedure in src/images/Makefile

I didn't look very hard for the cause, so I just removed the install_man parameter from the install task in Makefile

erreur fatale: QWebFrame : Aucun fichier ou dossier de ce nom

wkhtmltopdf version(s) affected: latest master commit

OS information
ArchLinux

Description

/tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/src/lib/converter.cc:19:10: erreur fatale: QWebFrame : Aucun fichier ou dossier de ce nom
   19 | #include <QWebFrame>
      |          ^~~~~~~~~~~
compilation terminée.
make[1]: *** [Makefile:390: converter.o] Error 1
make[1]: *** Attente des tâches non terminées....
Dans le fichier inclus depuis /tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/src/lib/multipageloader.cc:31:
/tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/src/lib/multipageloader_p.hh:28:10: erreur fatale: QWebFrame : Aucun fichier ou dossier de ce nom
   28 | #include <QWebFrame>
      |          ^~~~~~~~~~~
compilation terminée.
make[1]: *** [Makefile:380: multipageloader.o] Error 1
Dans le fichier inclus depuis /tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/src/lib/outline_p.hh:21,
                 depuis /tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/src/lib/outline.cc:22:
/tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/src/lib/outline.hh:21:10: erreur fatale: QWebElement : Aucun fichier ou dossier de ce nom
   21 | #include <QWebElement>
      |          ^~~~~~~~~~~~~
compilation terminée.
make[1]: *** [Makefile:430: outline.o] Error 1
/tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/src/lib/pdfconverter.cc:26:10: erreur fatale: QWebFrame : Aucun fichier ou dossier de ce nom
   26 | #include <QWebFrame>
      |          ^~~~~~~~~~~
compilation terminée.
make[1]: *** [Makefile:422: pdfconverter.o] Error 1
Dans le fichier inclus depuis ../../../prefix/include/QtCore/qobject.h:48,
[...]
make[1] : on quitte le répertoire « /tmp/makepkg/wkhtmltopdf-git/src/wkhtmltopdf/.cutekit/build/host-x86_64-28303022-007bae89/wk/src/lib »
make: *** [Makefile:61: sub-src-lib-install_subtargets-ordered] Error 2
Error: make: Process exited with code 2

How to reproduce
Try to build with the latest master and get the error (on Arch Linux)

Expected behavior
This

$ ./bootstrap.sh tools setup

$ ./bootstrap.sh wk configure

$ ./bootstrap.sh wk build

should work.

Build

Please, can you write well how to build wkhtmltopdf ? I can try with debian 12.0 but now work.

Thank you
Luca

Missing `-lssl -lcrypto` during linking of `wkhtmltoimage` on EL9

wkhtmltopdf version(s) affected: 0.13.0

OS information
RHEL 9.4

Description
When trying to compile the package we are unable to link the final wkhtmltoimage binary.

How to reproduce
Follow the steps on README.md to install the package, it will fail on ./bootstrap.sh wk build.

As for the dependencies just install it as:
dnf install -y python3.11 python3.11-pip git make gcc-g++ libX11-devel libXext-devel libXdmcp-devel libXrender-devel openssl-devel

PSA: libXdmcp-devel is only available on Codeready Builder / CRB / PowerTools.

Expected behavior
Successful compilation

Possible Solution
Just adding -lssl -lcrypto will solve the issue. I've manually done that with the command:

g++ -Wl,-O1 -o ../../bin/wkhtmltoimage outputter.o manoutputter.o htmloutputter.o textoutputter.o arghandler.o commondocparts.o commandlineparserbase.o commonarguments.o progressfeedback.o loadsettings.o logging.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o wkhtmltoimage.o imagearguments.o imagecommandlineparser.o imagedocparts.o moc_progressfeedback.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o -L/root/wkhtmltopdf/.cutekit/build/host-x86_64-28303022-81498e1a/prefix/lib -L/root/wkhtmltopdf/.cutekit/build/host-x86_64-28303022-81498e1a/prefix/plugins/codecs -lqcncodecs -L/root/wkhtmltopdf/.cutekit/build/host-x86_64-28303022-81498e1a/qt/lib -L/root/wkhtmltopdf/.cutekit/build/host-x86_64-28303022-81498e1a/prefix/lib -lqjpcodecs -lqkrcodecs -lqtwcodecs -lQtWebKit -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -lXrender -lXext -lX11 -lxcb -lXau -lXdmcp -lQtNetwork -lQtCore -lm -ldl -lrt -lpthread -lssl -lcrypto

But that isn't a solution. The build system should be modified to handle this.

fix: Support for multiple documents

Hi,

When trying to build multiples documents with this version, i'm getting following output:

wkhtmltopdf: Error: This version of wkhtmltopdf is built against an unpatched version of QT, and does not support more than one input document.

Is this possible to have a version with patched QT ?

Regards

Bootstrap host and arch

Hello, with /packaging we could choose the host and arch.

How do you do that with the boostrap.sh?

Building on M2 mac also fails:

.moc/release-static/../../../../../../../../qt/src/corelib/io/qfilesystemwatcher_fsevents_p.h:86:14: error: no struct named 'stat64' in the global namespace
    struct ::stat64 savedInfo;  // All the info for the path so we can compare it.
           ~~^
In file included from /dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents.cpp:46:
/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents_p.h:86:14: error: no struct named 'stat64' in the global namespace
    struct ::stat64 savedInfo;  // All the info for the path so we can compare it.
           ~~^
1 error generated.
In file included from /dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher.cpp:64:
/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents_p.h:86:14: error: no struct named 'stat64' in the global namespace
    struct ::stat64 savedInfo;  // All the info for the path so we can compare it.
           ~~^
make[2]: *** [.obj/release-static/moc_qfilesystemwatcher_fsevents_p.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents.cpp:77:39: error: no struct named 'stat64' in the global namespace
static bool operator==(const struct ::stat64 &left, const struct ::stat64 &right)
                                    ~~^
/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents.cpp:77:68: error: no struct named 'stat64' in the global namespace
static bool operator==(const struct ::stat64 &left, const struct ::stat64 &right)
                                                                 ~~^
/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents.cpp:90:39: error: no struct named 'stat64' in the global namespace
static bool operator!=(const struct ::stat64 &left, const struct ::stat64 &right)
                                    ~~^
/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents.cpp:90:68: error: no struct named 'stat64' in the global namespace
static bool operator!=(const struct ::stat64 &left, const struct ::stat64 &right)
                                                                 ~~^
1 error/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents.cpp generated:.
347:18: error: no struct named 'stat64' in the global namespace
        struct ::stat64 newInfo;
               ~~^
make[2]: *** [.obj/release-static/qfilesystemwatcher.o] Error 1
/dir/wkhtmltopdf/qt/src/corelib/io/qfilesystemwatcher_fsevents.cpp:348:15: error: no member named 'stat64' in the global namespace
        if (::stat64(it->absolutePath, &newInfo) == 0) {
            ~~^
7 errors generated.
make[2]: *** [.obj/release-static/qfilesystemwatcher_fsevents.o] Error 1
make[1]: *** [release] Error 2
make: *** [sub-corelib-make_default-ordered] Error 2
Error: make: Process exited with code 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.