[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [groff] Groff & tbl as a report generator
From: |
John Gardner |
Subject: |
Re: [groff] Groff & tbl as a report generator |
Date: |
Wed, 25 Jul 2018 07:45:05 +1000 |
Use wkhtmltopdf if you need a graphics-intensive output (such as background
images, colour fills and client logos embedded beside each table record).
This was the format an agency I worked at required be churned out fast, and
it had to match what was presented by the webapp. Thankfully the HTML/CSS
was done, I was just impressed at how closely wkhtmltopdf's PDF output
matched what browsers showed with HTML/CSS
*> 1. I figured HTML was just too loosey-goosey with the layout. I wanted
better control.*
You'll need CSS for that. ;-) HTML is for content, CSS for presentation and
layout.
*> 2. I figured HTML didn't deal with paging and repeating page headers,
column titles, and page numbers on each page.*
It does, actually. You just need to enclose your table's headers and
footers with <thead> and <tfoot>, respectively.
I've mocked up a simple demo here <http://jsfiddle.net/srh39jv2/23/>. Were
that table long enough to span multiple pages, the header and footer rows
should repeat across pages (possibly with the caption appended, I can't
remember...) But this should give you an idea of how the PDF is paged
similarly to a proper HTML/CSS print-out.
(I hope I've not siderailed this discussion too badly, haha)
On 25 July 2018 at 05:09, Blake McBride <address@hidden> wrote:
> Thanks. I've seen a tool or two that converts HTML to PDF in the past but
> I immediately shied away from them for the following reasons.
>
> 1. I figured HTML was just too loosey-goosey with the layout. I wanted
> better control.
>
> 2. I figured HTML didn't deal with paging and repeating page headers,
> column titles, and page numbers on each page.
>
> Am I wrong?
>
> I have to say, groff/tbl fits the bill well.
>
> Thanks!
>
> Blake
>
>
> On Tue, Jul 24, 2018 at 1:15 PM John Gardner <address@hidden>
> wrote:
>
>> Hi Blake, great to hear! Always nice to hear another Troff success story.
>> =)
>>
>> I know the feeling about finding decent PDF converters. The best one I
>> know of is wkhtmltopdf <https://wkhtmltopdf.org/>, which uses WebKit's
>> rendering engine to convert an HTML/CSS-enriched webpage into a
>> correctly-layered and paged PDF. Tables looked great and scaled perfectly
>> across pages.
>>
>> I strongly recommend wkhtmltopdf <https://wkhtmltopdf.org/> to anybody
>> else who finds themselves in need of a decent HTML-to-PDF converter.
>>
>> On 25 July 2018 at 03:26, Blake McBride <address@hidden> wrote:
>>
>>> A few years ago I thought of a really, really good use for groff and tbl.
>>> Thought I'd share.
>>>
>>> I write (web-based) business applications. Often I have to generate
>>> reports which largely mean PDF files. In the past, I used some
>>> open-source
>>> PDF generation utilities. They worked, but what a nightmare! Handling
>>> paging and lining everything up took hours.
>>>
>>> Then, a few years ago, I thought of generating groff/tbl input instead
>>> and
>>> then calling those tools to generate the final PDF output. This made my
>>> ability to produce reports skyrocket. I have a deep love of troff but
>>> don't get to use it as much as I'd like. Now I'll be using it all of the
>>> time.
>>>
>>> This is a great use of groff et al. I will be using it all of the time
>>> now!
>>>
>>> Blake McBride
>>>
>>
>>
Re: [groff] Groff & tbl as a report generator, James K. Lowden, 2018/07/24
Re: [groff] Groff & tbl as a report generator, Blake McBride, 2018/07/30