Bug 291279 - Trimming the margins of a multi-column layout.
Summary: Trimming the margins of a multi-column layout.
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 0.5.81
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-11 16:55 UTC by Alvaro Aguilera
Modified: 2013-03-08 15:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Okular's trim margins problem (225.04 KB, image/png)
2012-01-11 16:56 UTC, Alvaro Aguilera
Details
File that triggers the bug (can be freely accessed through http://ft.ornl.gov/pubs-archive/vetter-xfer/2000-sc00-umpire-vetter.pdf ) (145.65 KB, application/pdf)
2013-03-08 08:01 UTC, Yuri Chornoivan
Details
How the document show be rendered (minus the margins) (184.56 KB, image/png)
2013-03-08 08:09 UTC, Alvaro Aguilera
Details
with a fixed zoom level (271.83 KB, image/png)
2013-03-08 08:26 UTC, Alvaro Aguilera
Details
Left-margin (167.27 KB, image/png)
2013-03-08 14:33 UTC, Alvaro Aguilera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alvaro Aguilera 2012-01-11 16:55:36 UTC
Version:           0.5.81 (using KDE 4.7.4) 
OS:                Linux

Okular's trim margins feature doesn't like multi-column layouts, especially their last page, when there isn't enough text to start the second column. The image attached best illustrates the problem.

Reproducible: Always

Steps to Reproduce:
-Open a multi-column pdf whose last page contains only one column (but still a multi-column layout).
-enable the trim margin option
-go to the last page

Actual Results:  
last page is zoomed out of proportion

Expected Results:  
okular shouldn't zoom the text, just trim the margins.

OS: Linux (x86_64) release 3.0.6-2-desktop
Compiler: gcc
Comment 1 Alvaro Aguilera 2012-01-11 16:56:49 UTC
Created attachment 67703 [details]
Okular's trim margins problem
Comment 2 Albert Astals Cid 2013-03-07 22:42:52 UTC
Can you still reproduce this in a newer version? I remember we did a few improvements to trim margins support
Comment 3 Alvaro Aguilera 2013-03-08 07:39:45 UTC
It still happens with Okular 0.15.5 / KDE 4.9.5.
Comment 4 Fabio D'Urso 2013-03-08 08:00:52 UTC
I'm not sure this is a bug: it's kind of expected behavior because you have "Fit width" zoom and the algorithm treats each page independently.
Comment 5 Yuri Chornoivan 2013-03-08 08:01:28 UTC
Created attachment 77850 [details]
File that triggers the bug (can be freely accessed through http://ft.ornl.gov/pubs-archive/vetter-xfer/2000-sc00-umpire-vetter.pdf )

Confirmed for Poppler(git/master)/Okular(git/master) combination.
Comment 6 Alvaro Aguilera 2013-03-08 08:09:35 UTC
Created attachment 77851 [details]
How the document show be rendered (minus the margins)
Comment 7 Alvaro Aguilera 2013-03-08 08:11:04 UTC
@Fabio

did you see the image I attached at the beginning?
That's clearly a bug. Here is another picture showing the normal document.
We are not trying to "zoom" into the document, just to remove the margin as advertized.
Comment 8 Fabio D'Urso 2013-03-08 08:17:27 UTC
Sure, we remove margins (blank space) -> Page width is decreased -> "Fix width" uses a higher amount of magnification
Comment 9 Fabio D'Urso 2013-03-08 08:24:13 UTC
Try with a fixed zoom level (i.e. a number) instead
Comment 10 Alvaro Aguilera 2013-03-08 08:26:55 UTC
Created attachment 77854 [details]
with a fixed zoom level
Comment 11 Alvaro Aguilera 2013-03-08 08:30:49 UTC
I added a new screenshot with a fixed zoom level. The empty column on the right is treated as if it were a margin and removed. Perhaps okular should scan the document to determine the smallest margin and then trim that amount on every page, or something like that.

The lack of layout awareness also affects other functions, like the highlighter, etc.
Comment 12 Fabio D'Urso 2013-03-08 08:39:03 UTC
(In reply to comment #11)
> Perhaps okular should
> scan the document to determine the smallest margin and then trim that amount
> on every page, or something like that.
We can't: it would take ages to render the whole document :(

> The lack of layout awareness also affects other functions, like the
> highlighter, etc.
They are not related: Can you please open or check if some bug report exists about this issue?
Thanks :)
Comment 13 Albert Astals Cid 2013-03-08 11:01:48 UTC
Ok, i see what you want, that's not going to happen anytime soon for the reasons Fabio points out, but since whishing is free i'm going to move it to wish.
Comment 14 Alvaro Aguilera 2013-03-08 11:10:52 UTC
>We can't: it would take ages to render the whole document :(

How about using the left margin size as an upper bound when cutting the right margin?
Even if it only works for left-to-right languages, it would be still a step forward.

>Can you please open or check if some bug report exists about this issue?

I was referring to Bug 161324 and now I realize it has been fixed. Kudos!
Comment 15 Albert Astals Cid 2013-03-08 14:23:04 UTC
What is the "left margin size"?
Comment 16 Alvaro Aguilera 2013-03-08 14:33:18 UTC
Created attachment 77859 [details]
Left-margin
Comment 17 Alvaro Aguilera 2013-03-08 14:33:53 UTC
That would be the width of the left margin. See screenshot.
Comment 18 Albert Astals Cid 2013-03-08 14:34:41 UTC
We still have to go though all the pages to calculate that.
Comment 19 Alvaro Aguilera 2013-03-08 14:38:00 UTC
I don't know how okular currently determines what to trim, but that is probably done on demand page by page. What I propose is, for a given page, to limit the amount trimmed on the right, so that it's never bigger than the amount trimmed on the left.
Comment 20 Albert Astals Cid 2013-03-08 14:41:28 UTC
That's not trim margins, sorry.
That's "trim margins but have this very specific code to make Alvaro happy".
It's just not a general enough feature to make sense.
Comment 21 Fabio D'Urso 2013-03-08 14:43:09 UTC
Let alone RTL languages, about which I'm no expert at all, there are also some cases where that would lead to wasted space. For example even pages in http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf
Comment 22 Alvaro Aguilera 2013-03-08 14:52:04 UTC
If you have a document with a four-column layout and the last page has only a couple of lines of text filling only the first column, okular will chop off 75% of the page and zoom in the 25% to full screen. It's not trimming a margin but destroying the layout for this use-case.

In western languages you fill the text from left to right and from top to bottom. If you have to guess the margin sizes to chop off, it is better to use the left and top blank space, because that's where the text begins. The blank spaces on the right and on the bottom might not belong to the margin but to the text-space.

It has nothing to do with making me happy. I submit bugs to help you improve your apps. If you consider the current behavior a feature and not a bug, feel free to close the bug report.
Comment 23 Albert Astals Cid 2013-03-08 15:17:03 UTC
The feautre is described as removing the whitespace around the page, and that's what it does.

Yes, you as a human can do a better assessment of what'd you would like to get trimmed, but unles you code me a Skynet here i don't see a way for the code to be as smart as you want it to be so i'm closing the bug following your suggestion.

Of course we do appreciate your suggestion and personally I'm sorry we can't provide a solution for it.