Bug 32346 - PRINTING 'fit to printable page' for large documents results in missing content
Summary: PRINTING 'fit to printable page' for large documents results in missing content
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
(earliest affected)
3.3.0 release
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: ImpressDraw-Tables
  Show dependency treegraph
Reported: 2010-12-13 03:02 UTC by David Clayton
Modified: 2017-09-01 14:45 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

sample document (21.89 KB, application/vnd.oasis.opendocument.graphics)
2010-12-13 06:21 UTC, David Clayton
Test Document created with 4322 (110.35 KB, application/vnd.oasis.opendocument.graphics)
2014-10-24 07:29 UTC, David Clayton

Note You need to log in before you can comment on or make changes to this bug.
Description David Clayton 2010-12-13 03:02:49 UTC

I have a large drawing (page size set to A1)in Draw. This has items placed up to the margins. when printing on OO 3.2.1 and 'fit to printable page' is selected the document scales and prints on A4 paper as expected. 

With the 'new' printing interface on both OO 3.3 and LO 3.3 the above behaviour looks OK in the preview widow, but when the document is printed it unfortunately looses content on some of the margins - It does appear to reduce in size sufficiently. This is a regression as scaling works in previous OO versions.

I could attach a document, although I would have to edit to remove some information before making it public.

Comment 1 Cédric Bosdonnat 2010-12-13 05:43:55 UTC
(In reply to comment #0)
> I could attach a document, although I would have to edit to remove some
> information before making it public.

Could you please do so? otherwise we won't be able to reproduce this.
Comment 2 David Clayton 2010-12-13 06:21:00 UTC
Created attachment 41059 [details]
sample document


I have attached - You can create by starting a new draw document and setting the page size to A1 - draw a box with a border of 0.5 and no infill colour (saves toner), up to the page margins. Print with the 'fit to printable page' and onto an A4 printer. This does not resize as expected.

I thought it was something to do with the page margins, so I tried a different printer and got the same result. The 'fit to page' option works fine in oo 3.2.1.

Comment 3 Cédric Bosdonnat 2010-12-13 08:23:55 UTC
I can reproduce this on master build.

Thorsten, could you have a look at it?
Comment 4 Regina Henschel 2011-01-02 15:13:43 UTC
The missing parts are due to a wrong origin of the printed content.

I have tested this:
In sd/source/ui/view/DocumentRenderer.cxx after line 2273
I have added

if (bScalePage)
     long aPatchedPageOffsetX = aPageOffset.X()/(double)aMap.GetScaleX();
     long aPatchedPageOffsetY = aPageOffset.Y()/(double)aMap.GetScaleY();

With this settings 'fit to printable page' works for Draw documents. I have expected, that a simple shift would be enough, but the non printable margin is scaled somewhere when printed. In addition there are a lot of places with "#if 0" disabled origin settings. So I doubt, that this is the correct place at all.

I'm not familiar with printing and have no idea whether my changes would break something. Nevertheless, I hope my findings are useful for you.
Comment 5 Thorsten Behrens (allotropia) 2011-01-11 13:15:49 UTC
Regina, thanks for the research - yes, that should indeed help!
Comment 6 David Clayton 2012-10-26 15:35:02 UTC
I have re-tested on today and found behaviour still exists. Have changed version accordingly.
Comment 7 bfoman (inactive) 2013-07-26 09:35:02 UTC
(In reply to comment #6)
> I have re-tested on today and found behaviour still exists. Have
> changed version accordingly.

Please do not change the version field as it indicates the earliest version where bug is present. Changed to 3.3.0 value.
Please check if this is still an issue in the latest stable release.
Comment 8 Thorsten Behrens (allotropia) 2013-09-12 16:15:01 UTC
Apologies for not having gotten around fixing this bug yet; unfortunately in future I'll have even less time at my disposal for this, so I'm freeing up ownership for other volunteers to take over.
Comment 9 QA Administrators 2014-10-23 17:32:27 UTC Comment hidden (obsolete)
Comment 10 David Clayton 2014-10-24 07:29:32 UTC
Created attachment 108340 [details]
Test Document created with 4322
Comment 11 David Clayton 2014-10-24 07:42:16 UTC

I have re-tested with (Windows 7 x86)

The test document 'A1 print problem' shows the dialogue boxes present for that document. When print is selected, the print preview field shows 'legal' where does this get inferred from?

My belief is that when 'fit to printable page' is selected, LO should see that the printer is A4 and scale the document accordingly. perhaps I have misunderstood the intention of this function.

If this can't be determined automatically then perhaps it would be better solved by a new function 'print document on' with a print size selection?

It has been a long time, but from my initial post (and the confirmation) this scale to print function must have worked in the earlier version.
Comment 12 tmacalp 2015-06-22 16:45:19 UTC
There are a number of bugs that have affected this one.  Bug 63905 broke fit-to-page printing and was then merged into all active branches at the time (4.2.7, 4.3.2, and 4.4.0).  But that broken behavior was corrected and should be available in 5.0.0 (bug 87804).

So, with 5.0.0, this bug is at least testable again.  Unfortunately, LO still seems to not be honoring the original page size's margins.  My guess is these margins are also being scaled down, which leaves the fit-to-page copy being printed in the unprintable zone.

Also, the margins for fit-to-page printing seem to still be a little bit off and are shrinking the page more than they need to on the right/bottom sides.

With that second observation, I'd say it's likely that the page is simply not being centered properly after being scaled down.
Comment 13 David Clayton 2016-07-14 15:34:33 UTC
I've tested on the new and the issue isn't there any more: on fit to printable page, it correctly identifies A4 as the paper, and prints the document correctly.

I haven't marked the bug as resolved because when left on 'original size' the paper is still incorrectly identified as legal, when under document page properties it is shown as A1.

Comment 14 QA Administrators 2017-09-01 11:17:56 UTC Comment hidden (obsolete)
Comment 15 Regina Henschel 2017-09-01 14:45:34 UTC
No content missing in Version:
Build ID: 4c99b8a9de59f3c5280ff2944d9f828822897f4a
CPU threads: 4; OS: Windows 6.1; UI render: default; 
Locale: de-DE (de_DE); Calc: group