Bug 112690 - Incorrect page size when creating PDF from .odt file set to A4 paper size
Summary: Incorrect page size when creating PDF from .odt file set to A4 paper size
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2.3.3 release
Hardware: All Windows (All)
: medium normal
Assignee: Aron Budea
URL:
Whiteboard: target:6.2.0 target:6.1.0.2 target:6.3.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2017-09-27 09:46 UTC by Marius
Modified: 2019-09-21 12:11 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
document and PDF export examples (132.60 KB, application/zip)
2017-10-28 15:06 UTC, S. Christian Collins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marius 2017-09-27 09:46:28 UTC
Description:
An ODT file text document was set to A4 paper size (21.0 x 29.7cm, 8.27 x 11.69 inches), but exporting (File --> Export as PDF) as PDF, LibreOffice creates incorrect PDF paper size - 8.26 x 11.69 inches! Correct PDF A4 size must be 8.27 x 11.69 inches. I think it's a software bug.

Steps to Reproduce:
1. ODT page format set to A4
2. Press "File"
3. Press "Export as PDF"

Actual Results:  
-

Expected Results:
Exported PDF (A4) size must be 8.27 x 11.69 inches size.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Comment 1 Xisco Faulí 2017-10-01 22:41:26 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Comment 2 S. Christian Collins 2017-10-28 15:06:59 UTC
Created attachment 137341 [details]
document and PDF export examples

I can repro this bug as well with a page in letter size. If you look at the attached files, you will see a document file ("bug112690 test.odt") and two PDFs, one generated back on May 24, 2015 with an earlier version of LibreOffice, and another generated with version 5.4.2.2.

When viewed in Okular, the earlier generated PDF shows the correct page size (8.5 x 11 in), whereas the PDF generated with LO 5.4.2.2 shows the page size as 8.49961 x 10.9996 instead.

I discovered this bug because pdfjoin choked on the weird page size when trying to join multiple PDFs together.

I will see if I can pinpoint the first LO version that exhibits this bug.

In case it's important:
** My System **
OS: KDE Neon 5.11.2 64-bit (Plasma Desktop 5.11.2, KDE Frameworks 5.39.0, Qt 5.9.1)
Linux Kernel: 4.10.0.37-generic
Comment 3 S. Christian Collins 2017-10-29 05:57:32 UTC Comment hidden (obsolete)
Comment 4 S. Christian Collins 2017-10-29 06:03:40 UTC
Here is a direct link to the problem commit, "PDF export: work with double page size":

https://cgit.freedesktop.org/libreoffice/core/commit/?id=3a2ccb419c5face6fbf56b1a4877e675d4cd5fe8
Comment 5 Dieter Praas 2017-10-29 07:55:17 UTC
(In reply to S. Christian Collins from comment #2)
 
> I can repro this bug as well with a page in letter size. 

Perhaps I have overlooked something but referring to this comment I changed the status from UNCONFIRMED to NEW.
Comment 6 raal 2018-02-16 08:30:29 UTC
(In reply to S. Christian Collins from comment #4)
> Here is a direct link to the problem commit, "PDF export: work with double
> page size":
> 
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=3a2ccb419c5face6fbf56b1a4877e675d4cd5fe8

author	Miklos Vajna <vmiklos@collabora.co.uk>	2017-05-25 16:37:04 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2017-05-25 21:15:00 +0200
commit	3a2ccb419c5face6fbf56b1a4877e675d4cd5fe8 (patch)
tree	a2490fd4b9ca47425becac5e021cc280f28a26b9
parent	f80c3e37e59285875bc9ec025661bcf1b8fc60eb (diff)
tdf#108056 PDF export: work with double page size
Our coordinate system has the origo in the top left corner, PDF's one is
at the bottom left corner. So the page height affects the coordinate of
all widths and y positions. That page width is 870.25 in the case of the
bugdoc, but it was handled as 870 due to the integer rounding. The
coordinates and heights are now closer to the expected ones.



Adding Cc: to Miklos Vajna ; Could you possibly take a look at this one? Thanks
Comment 7 Commit Notification 2018-07-09 14:22:00 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9a7a419baf9a6aa9fc70d9e2a00dec3fbdeee565

tdf#112690: make page size of exported PDF closer to what is set

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Aron Budea 2018-07-09 14:37:56 UTC
The regression is fixed, backport to 6.1 is in gerrit.

While the fix improves accuracy in many cases, there could still be a minimal discrepancy in sometimes due to unit conversion from 1/100 mm -> twips -> 1/100 mm, eg. width of A4 document becomes 210.01 mm instead of 210 mm (height is correct). This is a different issue, and is tracked in bug 103682.
Comment 9 Commit Notification 2018-07-11 08:59:56 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b5035a5ec51e29851eaf6c195e7e12320baed36f&h=libreoffice-6-1

tdf#112690: make page size of exported PDF closer to what is set

It will be available in 6.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2018-11-22 09:15:03 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/1e603213e76975d37d091a625dfd24d1ac036d78%5E%21

Don't check page size on Win for tdf#112690 unit test

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.