Bug 92959 - PDF exported text boxes have weird border spacing
Summary: PDF exported text boxes have weird border spacing
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low trivial
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:pdf
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2015-07-27 13:08 UTC by Florian Wicke
Modified: 2023-12-29 15:51 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
sample textbox as displayed in adobe reader (9.61 KB, image/jpeg)
2015-07-27 13:08 UTC, Florian Wicke
Details
simple document with textbox (9.78 KB, application/vnd.oasis.opendocument.text)
2015-08-03 08:13 UTC, Florian Wicke
Details
simple document with textbox (PDF) (2.77 KB, application/pdf)
2015-08-03 08:14 UTC, Florian Wicke
Details
simple document with textbox (screenshot from Adobe Acrobat) (62.97 KB, image/jpeg)
2015-08-03 08:14 UTC, Florian Wicke
Details
simple document with textbox (small box) (9.49 KB, application/vnd.oasis.opendocument.text)
2015-08-03 08:37 UTC, Florian Wicke
Details
simple document with textbox (small box) (PDF) (2.77 KB, application/pdf)
2015-08-03 08:38 UTC, Florian Wicke
Details
Text box with a patch removing the cell padding (2.81 KB, application/pdf)
2017-01-22 22:16 UTC, JC Cardot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Wicke 2015-07-27 13:08:16 UTC
Created attachment 117465 [details]
sample textbox as displayed in adobe reader

Creating a PDF text box object, exporting/saving it as PDF and opening the PDF in Adobe Reader or other Readers like PDF X-Change-Viewer result in weird white inline borders between the writable field and the border of the field.

This just happens with "flat" or "3D" borders of text boxes. Text boxes without borders get correctly filled up so that the whole defined box space is filled with the writable field.

See attachement:

Black border is the normal text box with "3D" border. Blue field is the writable area.


Expected result: the blue field should be "maximised" to the border.

Actual result: if your font size is bigger than the blue box but would fit into the text box the font will be cut off.
Comment 1 tommy27 2015-07-28 04:34:25 UTC Comment hidden (obsolete)
Comment 2 tommy27 2015-07-28 04:34:52 UTC Comment hidden (obsolete)
Comment 3 Florian Wicke 2015-07-28 08:22:51 UTC
Hey,

LibreOffice version: all since about 3.2 - currently installed: 4.4.4.3
O/S: Windows 8.1 Pro

Steps to reproduce(loosely translated from the german descriptions):

- Open LibreOffice writer
- Add the form symbols to the menu if not enabled yet
- Click the "textfield" button (maybe "textbox")
- Draw the textbox at any size
- Click "Export to PDF"
- Open in any PDF reader - Adobe Reader works best because it hilights fillable forms in the blue background as shown in my attached screenshot

If i open the form in Adobe Acrobat i can see, that the form field is way smaller than the box border.

This feature was working correctly in 3.0 or 3.1 but is in this state since then.

A few versions ago it was even worse - the white inner border of the box overlayed the text inside even while printing. That seems no longer to do so - but the white border is still annoying for users who need to fill these forms.

Maybe make the cell padding of a text box at least configurable?
Comment 4 tommy27 2015-07-28 08:27:17 UTC Comment hidden (obsolete)
Comment 5 Buovjaga 2015-08-01 13:46:06 UTC
NitroPDF shows the fillable area correctly filling the text box.

Win 7 Pro 64-bit, Version: 4.4.4.3
Build ID: 2c39ebcf046445232b798108aa8a7e7d89552ea8
Locale: fi_FI
Comment 6 Joel Madero 2015-08-01 15:58:04 UTC Comment hidden (obsolete)
Comment 7 Florian Wicke 2015-08-03 08:13:45 UTC
Created attachment 117614 [details]
simple document with textbox
Comment 8 Florian Wicke 2015-08-03 08:14:06 UTC
Created attachment 117615 [details]
simple document with textbox (PDF)
Comment 9 Florian Wicke 2015-08-03 08:14:30 UTC
Created attachment 117616 [details]
simple document with textbox (screenshot from Adobe Acrobat)
Comment 10 Florian Wicke 2015-08-03 08:15:25 UTC
Hi,

as requested a sample document, this document exported as pdf and a screenshot of this document from Adobe Acrobat where you can see that the fillable "Textbox1" is placed inside the text box with cell padding.

New files:
* simple document with textbox: form_test.odt
* simple document with textbox (PDF): form_test.pdf
* simple document with textbox (screenshot from Adobe Acrobat): form_test.jpg
Comment 11 Florian Wicke 2015-08-03 08:37:38 UTC
Created attachment 117618 [details]
simple document with textbox (small box)
Comment 12 Florian Wicke 2015-08-03 08:38:05 UTC
Created attachment 117619 [details]
simple document with textbox (small box) (PDF)
Comment 13 Florian Wicke 2015-08-03 08:38:46 UTC
I added two more files where you can see the problem even better - even with NitroPDF.

If you fill the form the letters get cut inside the text box with the white padding border.
Comment 14 Buovjaga 2015-08-03 14:35:06 UTC
Ok, I was looking at it the wrong way.. I can confirm the behavior.
I don't see it as a problem, but I'll set to NEW anyways.
Comment 15 Florian Wicke 2015-10-01 17:05:05 UTC
Bug is still present in 5.0.2 and still very annoying :-(

I understand that there are more serious problems than just "layout bugs" but is there anything else i could do to help to get this padding problem fixed?
Comment 16 Buovjaga 2015-10-02 05:14:38 UTC
(In reply to Florian Wicke from comment #15)
> Bug is still present in 5.0.2 and still very annoying :-(
> 
> I understand that there are more serious problems than just "layout bugs"
> but is there anything else i could do to help to get this padding problem
> fixed?

If you want to lower the number of bugs in general, but don't know C++, you can start triaging reports to make them high-quality: https://wiki.documentfoundation.org/QA/Triage_For_Beginners
Thus you will help the developers fix bugs faster.

You might also try sponsoring your issue on FS: http://freedomsponsors.org/
Comment 17 JC Cardot 2017-01-22 22:16:50 UTC
Created attachment 130614 [details]
Text box with a patch removing the cell padding

The bug is in core/vcl/source/gdi/pdfwriter_impl.cxx
around line 4218, it reads:
        if( rWidget.Border )
        {
            // adjust edit area accounting for border
            sal_Int32 nDelta = aFont.GetFontHeight()/4;
            if( nDelta < 1 )
                nDelta = 1;
            rIntern.m_aRect.Left()  += nDelta;
            rIntern.m_aRect.Top()   += nDelta;
            rIntern.m_aRect.Right() -= nDelta;
            rIntern.m_aRect.Bottom()-= nDelta;
        }
Commenting all of this in order no to apply anymore the nDelta leads to the attachment, which if I understand correctly is what Florian wants.
Note that the attachment has been created using the form_test.odt attachment provided here.
Comment 18 JC Cardot 2017-01-22 22:31:01 UTC
By the way I traced this to the following commit:
commit a921db6cce1298ad286cb778e5138d6a4ddc4508
Author: Jens-Heiner Rechtien <hr@openoffice.org>
Date:   Wed Sep 8 15:21:42 2004 +0000
which contains loads of changes, but might be related to "2004/05/18 13:57:02 pl 1.62.32.18: begin to implement PDF widgets", so I'd say that it has "always" been there; this was Ooo 1.1.2 or 1.1.3...
(some newer commits did change this code a little, but not its behaviour, there are only changes of names of parameters or method names).
Comment 19 Florian Wicke 2017-01-23 09:07:40 UTC
Yes, the attached document from JC Cardot is exactly what i meant it should be. Is there any reason to add this nDelta to the border area?
Comment 20 Buovjaga 2017-01-23 09:32:43 UTC
JC: thank you for the investigation. Please submit the patch to gerrit so developers can review it: https://wiki.documentfoundation.org/Development/gerrit

Also relevant: https://wiki.documentfoundation.org/Development/GetInvolved

If you want to continue looking into bug fixes, that would be great. An alternative would be to continue as a QA investigator: https://wiki.documentfoundation.org/QA
Just asking as we desperately need skilled bug detectives like yourself.
Comment 21 QA Administrators 2018-09-14 02:47:31 UTC Comment hidden (obsolete)
Comment 22 eisa01 2019-11-09 20:50:41 UTC
Still the case, also on Mac

Version: 6.4.0.0.alpha1+
Build ID: 25c390e17a7f1c018b5eed1ef7dfd568b76f4a84
CPU threads: 4; OS: Mac OS X 10.14.6; UI render: default; VCL: osx; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 23 QA Administrators 2021-11-09 04:38:32 UTC Comment hidden (obsolete)
Comment 24 JC Cardot 2021-11-09 09:41:01 UTC
Still the case in 7.1.7.2
Comment 25 QA Administrators 2023-11-10 03:14:04 UTC Comment hidden (obsolete)
Comment 26 eisa01 2023-12-29 15:51:54 UTC
Still present I think. Seems to also have a code pointer in comment #17

Version: 24.2.0.0.beta1 (AARCH64) / LibreOffice Community
Build ID: 5f390384195b7264c6e52add9e90a39790285249
CPU threads: 10; OS: macOS 14.2; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded