After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 693363 - Printing splits invoice through middle of an entry
Printing splits invoice through middle of an entry
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Reports
2.4.x
Other Linux
: Normal normal
: ---
Assigned To: gnucash-reports-maint
gnucash-reports-maint
: 679012 719613 743416 769366 (view as bug list)
Depends on:
Blocks: 660027
 
 
Reported: 2013-02-07 21:12 UTC by jeremy
Modified: 2018-06-29 23:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description jeremy 2013-02-07 21:12:15 UTC
When I have more than 28 entries, the 29 entry is split half printed on the 1st page and half on the 2nd page. The number of entries will depend on size of header and so forth.
Comment 1 Geert Janssens 2013-03-01 16:04:51 UTC
Thank you for your report.

I can confirm this. The problem not only affects invoices but all reports with tables that don't fit on one page.

It's not an easy problem to solve unforturnately. I'll add some technical information here in case someone wants to look into the problem to fix it.

The core of the problem is that our reports have no style information for printing. And there is a bug in webkit (the html renderer/printer we use for our reports) that ignores the style information even if we would be able to add it.

First the missing style information. Our reports currently use very primitive html formatting. This is a legacy from when our html engine was gtkhtml which just didn't support css styles and only could use very rudimentary html tag attributes for styling. Meanwhile GnuCash has moved on to webkit, but the reports haven't been altered (except for two or three e-guile based reports).

Css does provide attributes to control the way content should be kept together or split while printing [1]. The first part of the solution would be to adapt our reports to actually use these attributes in our reports. I did look into it, but the guile code to generate html reports was too complicated for me to fix this in the time frame I had.

But then, suppose the css attributes end up in the proper locations, we would next hit the webkit bug [2]. It appears webkit is ignoring some of the crucial css attributes required to fix this. The bug is open for 8 years now. I wonder if it will ever be fixed.


[1] See for example here: http://stackoverflow.com/questions/8712677/how-to-apply-css-page-break-to-print-a-table-with-lots-of-rows
[2] https://bugs.webkit.org/show_bug.cgi?id=5097
Comment 2 Geert Janssens 2013-11-30 17:08:56 UTC
*** Bug 719613 has been marked as a duplicate of this bug. ***
Comment 3 Geert Janssens 2013-12-07 17:55:31 UTC
*** Bug 679012 has been marked as a duplicate of this bug. ***
Comment 4 nohamnospam 2015-01-02 23:57:26 UTC
To anyone it may concern: My workaround is 
1. html-export from gnucash
2. wkhtmltopdf -B 10 -L 20 -R 20 -T 10 in.html out.pdf

So far no splitsies.

Best
A
Comment 5 Geert Janssens 2015-01-24 15:56:18 UTC
*** Bug 743416 has been marked as a duplicate of this bug. ***
Comment 6 Mike Evans 2016-08-01 09:47:23 UTC
*** Bug 769366 has been marked as a duplicate of this bug. ***
Comment 7 Mike Evans 2016-10-28 07:50:31 UTC
I think this may be fixed in the latest webkit release. Related bugs appear to have been fixed in Chrome, which uses webkit. https://bugs.chromium.org/p/chromium/issues/detail?id=642814 it seems.

I can't compile the latest webkit https://webkitgtk.org/2016/10/26/webkitgtk2.15.1-released.html as my gcc is too old apparently.
Comment 8 hugh 2016-10-28 12:11:25 UTC
My understanding is that Chrome uses a forked version of WebKit.  That fork is called "Blink".  Is there a fix in WebKit?

<https://blog.chromium.org/2013/04/blink-rendering-engine-for-chromium.html>

On the other hand, the fix appears to be in a tree call "webkit".  Is it upstreamed?  If not, perhaps it can be ported.
Comment 9 John Ralls 2016-10-28 13:49:35 UTC
Unfortunately it doesn't matter. As noted in bug 751635, GnuCash uses version 1 of the WebKit API for which WebKit dropped support in 2.5. 

As for chromium, it lacks the Gtk glue needed to actually draw to GnuCash's window, so substantial work would be needed to switch.
Comment 10 nohamnospam 2016-10-28 13:52:53 UTC
Again why not html it out, and use wkhtmltopdf per lib, as in my workaround?
Comment 11 Mike Evans 2016-10-29 07:40:41 UTC
(In reply to nohamnospam from comment #10)
> Again why not html it out, and use wkhtmltopdf per lib, as in my workaround?

Patches are always welcome.
Comment 12 nohamnospam 2016-10-29 10:36:35 UTC
I see what you did there, and I like and respect it. :)
Comment 13 Geert Janssens 2016-10-29 12:07:19 UTC
(In reply to nohamnospam from comment #10)
> Again why not html it out, and use wkhtmltopdf per lib, as in my workaround?

While that may be a solution, it hasn't happened yet mainly because no one took it up. I did look into it quite some time ago, but came to to conclusion then it would be too much work (for me).

To start it would mean having two code paths in gnucash for outputting the report: either to pdf (and to print) or to screen.

Then wkhtmltopdf is not available on Windows/MingW32 or at least it wasn't when I last checked. Which means we need to build it from scratch. I started that once, but never got through it.

And the same probably goes for the OS X port.

So... sure, it can be done but it's not a light task.
Comment 14 Geert Janssens 2017-04-12 09:43:40 UTC
An update: in order to solve bug 751635 the gnucash devs are currently working on migrating gnucash to the webkit2 interface (which also requires migrating to gtk3).

I've tested the work so far and it appears this is indeed fixed with more recent webkit versions. My Fedora system has 2.16 and lines are no longer cut in half when printing with that version. I'm not sure which version fixes it though so it may be this issue will continue to happen on platforms using less recent gtkwebkit2 versions.
Comment 15 John Ralls 2017-09-24 22:15:59 UTC
Reassign version to 2.4.x so that individual 2.4 versions can be retired.
Comment 16 Robert Chapin 2018-05-02 16:10:56 UTC
This problem also affects Windows and is not resolved as of GnuCash 3.1.
Comment 17 John Ralls 2018-06-29 23:13:39 UTC
GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=693363. Please continue processing the bug there and please update any external references or bookmarks.