NEW: textproc/wkhtmltopdf

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

NEW: textproc/wkhtmltopdf

Frank Groeneveld-2
This is my first attempt at writing a port.

wkthmltopdf is a program that uses Webkit to convert an HTML file to a
PDF or image file.  More information can be found on their website:
http://wkhtmltopdf.org

I use it in a number of Ruby on Rails applications with the wickedpdf
gem to generate PDF invoices for example.

Note that upstream advises to build it using their patched QT in order
to support the following options:

  * Printing more then one HTML document into a PDF file.
  * Running without an X11 server.
  * Adding a document outline to the PDF file.
  * Adding headers and footers to the PDF file.
  * Generating a table of contents.
  * Adding links in the generated PDF file.
  * Printing using the screen media-type.
  * Disabling the smart shrink feature of webkit.

My port doesn't use their patched QT as I find it quite ugly. However,
some of these options are pretty handy on servers, especially running
without an X11 server.

What are your thoughts and comments on this port?

Frank

wkhtmltopdf-port-0.12.2.4p0.tar.gz (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Frank Groeneveld-2
On 10/23/15 22:27, Frank Groeneveld wrote:

> This is my first attempt at writing a port.
>
> wkthmltopdf is a program that uses Webkit to convert an HTML file to a
> PDF or image file.  More information can be found on their website:
> http://wkhtmltopdf.org
>
> I use it in a number of Ruby on Rails applications with the wickedpdf
> gem to generate PDF invoices for example.
>
> Note that upstream advises to build it using their patched QT in order
> to support the following options:
>
>   * Printing more then one HTML document into a PDF file.
>   * Running without an X11 server.
>   * Adding a document outline to the PDF file.
>   * Adding headers and footers to the PDF file.
>   * Generating a table of contents.
>   * Adding links in the generated PDF file.
>   * Printing using the screen media-type.
>   * Disabling the smart shrink feature of webkit.
>
> My port doesn't use their patched QT as I find it quite ugly. However,
> some of these options are pretty handy on servers, especially running
> without an X11 server.
>
> What are your thoughts and comments on this port?
>
> Frank

Ping?

It's quite a simple port which only takes a few minutes to build on my
machine. You can then test it by running something like:
wkhtmltopdf http://www.openbsd.org/ openbsd.pdf

Frank

Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Frank Groeneveld-2
On 10/31/15 16:47, Frank Groeneveld wrote:
> Ping?
>
> It's quite a simple port which only takes a few minutes to build on my
> machine. You can then test it by running something like:
> wkhtmltopdf http://www.openbsd.org/ openbsd.pdf
>
> Frank

As noted by somebody off-list, it might be useful to have the port
attached again to my ping mail, so people don't have to search for it.
I've attached it to this mail. Please let me know what you think about it.

Frank

wkhtmltopdf-port-0.12.2.4p0.tar.gz (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Landry Breuil-6
On Tue, Nov 03, 2015 at 07:53:21PM +0100, Frank Groeneveld wrote:

> On 10/31/15 16:47, Frank Groeneveld wrote:
> >Ping?
> >
> >It's quite a simple port which only takes a few minutes to build on my
> >machine. You can then test it by running something like:
> >wkhtmltopdf http://www.openbsd.org/ openbsd.pdf
> >
> >Frank
>
> As noted by somebody off-list, it might be useful to have the port attached
> again to my ping mail, so people don't have to search for it. I've attached
> it to this mail. Please let me know what you think about it.

That reads good to me - minor nit, if you run make update-plist it
should remove the man/ man/man1/ dirs from the PLIST which i think are
not needed.

As for the background dep on QT4, i highly prefer depending on the
existing one instead of building another bundled copy, so the way you
did it makes perfect sense.

(note: havent built/tested it yet)

Landry

Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Jeremie Courreges-Anglas-2
Landry Breuil <[hidden email]> writes:

> On Tue, Nov 03, 2015 at 07:53:21PM +0100, Frank Groeneveld wrote:
>> On 10/31/15 16:47, Frank Groeneveld wrote:
>> >Ping?
>> >
>> >It's quite a simple port which only takes a few minutes to build on my
>> >machine. You can then test it by running something like:
>> >wkhtmltopdf http://www.openbsd.org/ openbsd.pdf
>> >
>> >Frank
>>
>> As noted by somebody off-list, it might be useful to have the port attached
>> again to my ping mail, so people don't have to search for it. I've attached
>> it to this mail. Please let me know what you think about it.
>
> That reads good to me - minor nit, if you run make update-plist it
> should remove the man/ man/man1/ dirs from the PLIST which i think are
> not needed.

Confirmed.

Another nit: the first word in COMMENT should not be capitalized:
Convert -> convert.

Other than that, ok jca@ to import.

Frank: it would be nice to discuss upstream how the manpage install path
should be handled.  OTOH I don't think that gzip'ed manpages are
a problem.

> As for the background dep on QT4, i highly prefer depending on the
> existing one instead of building another bundled copy, so the way you
> did it makes perfect sense.

Well, the only place where I've seen wkhtmltopdf used is within Odoo
(https://www.odoo.com/), where it's used to produce invoices,
quotations, etc.  And there you *need* a wkhtmltopdf program built
against the bundled and patched Qt.  But since I don't see anyone
porting Odoo to OpenBSD tomorrow I think we're fine with using Qt from
ports. (:

--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Frank Groeneveld-2
On 11/03/15 21:59, Landry Breuil wrote:
 > That reads good to me - minor nit, if you run make update-plist it
 > should remove the man/ man/man1/ dirs from the PLIST which i think are
 > not needed.

Thanks for the feedback, I've done this and the updated PLIST is in the
tarball attached.

On 11/04/15 18:08, Jérémie Courrèges-Anglas wrote:
> Another nit: the first word in COMMENT should not be capitalized:
> Convert -> convert.

Fixed that too, thank you for testing.

> Other than that, ok jca@ to import.

Could somebody commit it for me? I don't have commit access.

> Frank: it would be nice to discuss upstream how the manpage install path
> should be handled.  OTOH I don't think that gzip'ed manpages are
> a problem.

You mean making the manpage installation path configurable, so that we
don't need to patch around it?

>> As for the background dep on QT4, i highly prefer depending on the
>> existing one instead of building another bundled copy, so the way you
>> did it makes perfect sense.
>
> Well, the only place where I've seen wkhtmltopdf used is within Odoo
> (https://www.odoo.com/), where it's used to produce invoices,
> quotations, etc.  And there you *need* a wkhtmltopdf program built
> against the bundled and patched Qt.  But since I don't see anyone
> porting Odoo to OpenBSD tomorrow I think we're fine with using Qt from
> ports. (:
That's right, we use it in our company to create PDF files with headings
and page numbers on headless servers, so eventually I would need the
patced QT also. Would it be possible to make a flavor of this that is
normally not build?

Frank

wkhtmltopdf-port-0.12.2.4p1.tar.gz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Stuart Henderson-6
On 2015/11/04 21:48, Frank Groeneveld wrote:

> On 11/03/15 21:59, Landry Breuil wrote:
> > That reads good to me - minor nit, if you run make update-plist it
> > should remove the man/ man/man1/ dirs from the PLIST which i think are
> > not needed.
>
> Thanks for the feedback, I've done this and the updated PLIST is in the
> tarball attached.
>
> On 11/04/15 18:08, Jérémie Courrèges-Anglas wrote:
> >Another nit: the first word in COMMENT should not be capitalized:
> >Convert -> convert.
>
> Fixed that too, thank you for testing.
>
> >Other than that, ok jca@ to import.
>
> Could somebody commit it for me? I don't have commit access.

Done. (I also added a blank line before the COMMENT).

> >>As for the background dep on QT4, i highly prefer depending on the
> >>existing one instead of building another bundled copy, so the way you
> >>did it makes perfect sense.
> >
> >Well, the only place where I've seen wkhtmltopdf used is within Odoo
> >(https://www.odoo.com/), where it's used to produce invoices,
> >quotations, etc.  And there you *need* a wkhtmltopdf program built
> >against the bundled and patched Qt.  But since I don't see anyone
> >porting Odoo to OpenBSD tomorrow I think we're fine with using Qt from
> >ports. (:
>
> That's right, we use it in our company to create PDF files with headings and
> page numbers on headless servers, so eventually I would need the patced QT
> also. Would it be possible to make a flavor of this that is normally not
> build?

Seems pretty common for Qt things unfortunately. phantomjs needs a
patched Qt too, calibre uses private interfaces so it needs a :patch
target to find the headers...

I wonder how much time it would add to builds, it loses a lot of
features without the patched Qt (and I have somewhere I might
want to use that too).

Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Frank Groeneveld-2
On 11/04/15 22:34, Stuart Henderson wrote:
> Done. (I also added a blank line before the COMMENT).

Thank you!

> Seems pretty common for Qt things unfortunately. phantomjs needs a
> patched Qt too, calibre uses private interfaces so it needs a :patch
> target to find the headers...

Yes, I saw the phanomjs port indeed. I've built wkhtmltopdf with it's
statically linked, patched QT and needed a few patches from the
phantomjs port to get it going. It seems however, phantomjs is always
statically build against the patched qt.

> I wonder how much time it would add to builds, it loses a lot of
> features without the patched Qt (and I have somewhere I might
> want to use that too).

On my computer the current port builds within minutes, while the build
with patched QT takes around one hour.

I'll try to make a port for it, I got it building a few weeks ago:
https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1991

Frank

Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Amit Kulkarni-5
On Thu, Nov 5, 2015 at 1:26 PM, Frank Groeneveld <
[hidden email]> wrote:

> On 11/04/15 22:34, Stuart Henderson wrote:
>
>> Done. (I also added a blank line before the COMMENT).
>>
>
> Thank you!
>
> Seems pretty common for Qt things unfortunately. phantomjs needs a
>> patched Qt too, calibre uses private interfaces so it needs a :patch
>> target to find the headers...
>>
>
> Yes, I saw the phanomjs port indeed. I've built wkhtmltopdf with it's
> statically linked, patched QT and needed a few patches from the phantomjs
> port to get it going. It seems however, phantomjs is always statically
> build against the patched qt.
>
> I wonder how much time it would add to builds, it loses a lot of
>> features without the patched Qt (and I have somewhere I might
>> want to use that too).
>>
>
> On my computer the current port builds within minutes, while the build
> with patched QT takes around one hour.
>
> I'll try to make a port for it, I got it building a few weeks ago:
> https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1991
>
>
I asked the upstream author privately, and he said that if you prefer the
stock qt4 or the "unpatched" as he calls it, you can switch as well to the
qt5 in ports.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Frank Groeneveld-2
On 11/09/15 17:51, Amit Kulkarni wrote:
> I asked the upstream author privately, and he said that if you prefer the
> stock qt4 or the "unpatched" as he calls it, you can switch as well to the
> qt5 in ports.

Thanks for bringing that to my attention! It does compile and seems to
run fine against qt5 in ports indeed.

What would be the correct way to support both qt versions in this port?
A multi-package port with a -qt4 and -qt5 variant?

Frank

Reply | Threaded
Open this post in threaded view
|

Re: NEW: textproc/wkhtmltopdf

Amit Kulkarni-5
On Wed, Nov 11, 2015 at 1:07 PM, Frank Groeneveld <
[hidden email]> wrote:

> On 11/09/15 17:51, Amit Kulkarni wrote:
>
>> I asked the upstream author privately, and he said that if you prefer the
>> stock qt4 or the "unpatched" as he calls it, you can switch as well to the
>> qt5 in ports.
>>
>
> Thanks for bringing that to my attention! It does compile and seems to run
> fine against qt5 in ports indeed.
>
> What would be the correct way to support both qt versions in this port? A
> multi-package port with a -qt4 and -qt5 variant



why have multi-packages for the same functionality? eventually the ports@
tree will move towards qt5. qt4 is deprecated and over time will suffer
bit-rot, so if it works equally well with stock qt5 (with missing
features), IMHO wkhtmltopdf should be switched to work with qt5 only. but
you are the maintainer and it has to be acceptable with other porters too.
IMHO, it will slowly push the ports tree forward.

thanks