https://bugs.documentfoundation.org/show_bug.cgi?id=148033
Bug ID: 148033
Summary: Loss of precision in /MediaBox: `nMediaBoxWidth` and
`nMediaBoxHeight` in `PDFWriterImpl::emitCatalog()`
should be `double` in accordance with
`PDFPage::emit()`.
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Writer
Assignee: [email protected]
Reporter: [email protected]
Description:
In the output from PDFWriterImpl::emitCatalog(), `/MediaBox` parameters are
truncated to integers. And we might lose precision in `/MediaBox`.
Steps to Reproduce:
1. Create Writer Document.
2. Select from the menu: File -> Export As -> Export As PDF..., and press
Export.
3. Save as sample.pdf
4. Inspect the sample.pdf (e.g. `cat sample.pdf`, or `grep -a /MediaBox
sample.pdf`).
Actual Results:
There are two `/MediaBox`s:
```
/MediaBox[0 0 595.303937007874 841.889763779528]
```
and
```
/MediaBox[ 0 0 595 841 ]
```
The former is the output from `PDFPage::emit()` and the latter is from
`PDFWriterImpl::emitCatalog()`.
Expected Results:
The two `/MediaBox` should be same:
```
/MediaBox[0 0 595.303937007874 841.889763779528]
```
and
```
/MediaBox[0 0 595.303937007874 841.889763779528]
```
Reproducible: Always
User Profile Reset: No
Additional Info:
This is a patch for the commit eae375a224b44cd5bb18e180732668668ee9178f
========
>From 132753a0026072c13506c4765622c0eada9c31b3 Mon Sep 17 00:00:00 2001
From: Lemures Lemniscati <[email protected]>
Date: Wed, 16 Mar 2022 21:06:37 +0900
Subject: [PATCH] Use double instead of sal_Int32 for nMediaBoxWidth and
nMediaBoxHeight
`nMediaBoxWidth` and `nMediaBoxHeight` in `PDFWriterImpl::emitCatalog()`
should be `double` in accordance with `PDFPage::emit()`.
---
vcl/source/gdi/pdfwriter_impl.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx
b/vcl/source/gdi/pdfwriter_impl.cxx
index fc15be2be..1847eb7d7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4539,8 +4539,8 @@ bool PDFWriterImpl::emitCatalog()
aLine.append( getResourceDictObj() );
aLine.append( " 0 R\n" );
- sal_Int32 nMediaBoxWidth = 0;
- sal_Int32 nMediaBoxHeight = 0;
+ double nMediaBoxWidth = 0;
+ double nMediaBoxHeight = 0;
sal_Int32 nUserUnit = 1;
if( m_aPages.empty() ) // sanity check, this should not happen
{
--
2.35.1
--
You are receiving this mail because:
You are the assignee for the bug.