Bug 103682 - PDF export A4, A5 paper size is imprecise
Summary: PDF export A4, A5 paper size is imprecise
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:pdf
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2016-11-03 16:08 UTC by Walter
Modified: 2019-03-16 20:57 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
PDF A4 make with LO 3.3.0.4 (1.32 KB, application/pdf)
2017-11-27 22:53 UTC, Walter
Details
PDF A4 make with LO 5.4.3 (1.34 KB, application/pdf)
2017-11-27 22:54 UTC, Walter
Details
Export to PDF A4 from LO Draw 6.2 alpha 0 (1.45 KB, application/pdf)
2018-06-29 20:06 UTC, Roman Kuznetsov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Walter 2016-11-03 16:08:05 UTC
Hi,

when i export blank Draw A4 document into pdf, the mediabox is not correct.
I have this mediabox :
--
1 0 obj
<</Type/Page/Parent 4 0 R/Resources 6 0 R/MediaBox[0 0 595 842]/Group<</S/Transparency/CS/DeviceRGB/I true>>/Contents 2 0 R>>
endobj
--
If i open with Acrobat Pro, i have : 209.91mm x 297.04mm - 595pt x 842pt
The correct size for A4 document is : 210mm x 297mm - 595,27559pt x 841,88976pt

reproduce with Calc and Writer. I try with A5 with same issue.

Thanks for your job.
-- Version: 5.2.2.2
-- Build ID: 8f96e87c890bf8fa77463cd4b640a2312823f3ad
-- Threads CPU : 8; Version de l'OS :Windows 6.2; UI Render : par défaut; 
-- Locale : fr-FR (fr_FR); Calc: group
Comment 1 Buovjaga 2016-11-19 19:41:27 UTC
If I open with Master PDF Editor, select the page and see object properties, I get
width: 595.20001
height: 841.90002

It does not match your 595,27559pt x 841,88976pt.

Please give a link to your source of these unrounded pt values or tell the method by which you arrived at them.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.3.0.0.alpha1+
Build ID: f533b3f39956fe8028c1f7f7cc3c37b0feed8b57
CPU Threads: 8; OS Version: Linux 4.8; UI Render: default; VCL: kde4; Layout Engine: new; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on November 19th 2016

Arch Linux 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 2 Walter 2016-11-26 08:52:48 UTC
unrounded pt values is calculate : Convert mm to inch and convert inch to points, 1 inche = 72 points

210mm = 8.26771in = 595.27559pt
297mm = 11.69291in = 841.88976pt

if you make a pdf with indesign, they are 3 number after point. 
I use text edit software, and i see the document boxes value.


Source of reference :
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf

If you do not put three digits after the comma, you do not have the right value in adobe acrobat pro. If you want to work with a printer, you need a correct display with acrobat pro

PyPDF2
Comment 3 QA Administrators 2017-11-27 09:59:12 UTC Comment hidden (obsolete)
Comment 4 Walter 2017-11-27 22:53:30 UTC
Created attachment 138029 [details]
PDF A4 make with LO 3.3.0.4
Comment 5 Walter 2017-11-27 22:54:29 UTC
Created attachment 138030 [details]
PDF A4 make with LO 5.4.3
Comment 6 Walter 2017-11-27 22:57:15 UTC
Hello,
I did the tests with LibreOffice 3.3.0.4:
Attachment : A4-libreoffice-3.3.0.4.pdf
Result : MediaBox[0 0 595 842]


I did the tests with LibreOffice 5.4.3:
Attachment : A4-Lo-5.4.3.pdf
Result : MediaBox[0 0 595.247244094488 841.861417322835]


with LibreOffice 5.4.3 the result is more accurate, but not yet accurate.

X, there is 0.09722222209 error ~ 0.1 mm
Y, there is 0.3138888887mm error ~ 0.3 mm

Correct size :

X, 210mm = 8.26771in = 595.27559pt
Y, 297mm = 11.69291in = 841.88976pt
Comment 7 Roman Kuznetsov 2018-06-29 20:05:25 UTC
I tried export to PDF drawing from LO Draw

Version: 6.2.0.0.alpha0+ (x64)
Build ID: d8733e2c59f120acf9feddff04964becc3358621
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
TinderBox: Win-x86_64@62-TDF, Branch:master, Time: 2018-06-26_11:09:03
Locale: ru-RU (ru_RU); Calc: CL

and got PDF with 21,0 x 29,7 cm


>X, there is 0.09722222209 error ~ 0.1 mm
>Y, there is 0.3138888887mm error ~ 0.3 mm


are we sure, that correct export to PDF should be with accuracy more than 0,1 mm?
Comment 8 Roman Kuznetsov 2018-06-29 20:06:19 UTC
Created attachment 143214 [details]
Export to PDF A4 from LO Draw 6.2 alpha 0
Comment 9 Aron Budea 2018-07-07 00:31:12 UTC
There's a -0.01 mm difference in size in the PDF exporter code, which could be reliably eliminated, however then in some cases (Writer and Calc) there'd be a 0.01 mm difference because of conversion.

I debugged the Calc case, and the page size is coming from twips (probably also converted from mm at the start, as the fixed page sizes are given in their standard unit, then converted to 1/100 mm units for better accuracy):
11906 twips -> 210.01 mm

Unfortunately if it was stored as 11905 twips, that'd be converted to 209.99 mm, which would also be off.

Interestingly Draw doesn't seem to be affected by this, no idea why.