Bug 152246 - Wrong horizontal position for the RTL content control fields in the exported PDF file
Summary: Wrong horizontal position for the RTL content control fields in the exported ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.0.3 release
Hardware: All All
: medium normal
Assignee: Hossein
URL:
Whiteboard: target:7.6.0 target:7.5.4
Keywords:
Depends on:
Blocks: Form-Controls
  Show dependency treegraph
 
Reported: 2022-11-26 21:12 UTC by Hossein
Modified: 2023-05-03 08:03 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
PDF output from LO 7.5 dev master (283.70 KB, application/pdf)
2022-11-26 21:12 UTC, Hossein
Details
Wrong hotizontal position of the fields visible in the PDF file opened in Firefox (52.30 KB, image/png)
2022-11-28 01:53 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2022-11-26 21:12:17 UTC
Created attachment 183823 [details]
PDF output from LO 7.5 dev master

Description:
When exporting/printing a file containing content control fields, horizontal position for RTL fields is wrong, and overlaps text.

Steps to Reproduce:
1. Open attachment 182846 [details].
2. Open "File" > "Export as" > "Export as PDF" menu option
3. In "General" tab, column 2, check "Create PDF form", and set "Submit Format" to "FDF".
4. Click "Export" to export the document to PDF.
5. Open the exported file either in "Adobe Acrobat" or "Mozilla Firefox" to see the exported fields.

Or, simply open the PDF attachment in Acrobat or Firefox.

Actual Results:
The RTL fields from page 1 are incorrectly place horizontally and overlap other parts of text. On the other hand, LTR fields from the last page are placed correctly.

Expected Results:
The fields in PDF file should be placed in the position that were in the source file.

Reproducible: Always


User Profile Reset: No


Additional Info:
Version: 7.5.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 6bf5dd8faea420aa0dbc7c429952c9868bcadb9e
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Hossein 2022-11-26 21:51:15 UTC
@Miklos:
I would like to fix this issue. Could you please give me some advise/code pointers?

I see boundary calculations inside SwContentControlPortion::DescribePDFControl in sw/source/core/text/itrform2.cxx.
Comment 2 Hossein 2022-11-28 01:53:22 UTC
Created attachment 183842 [details]
Wrong hotizontal position of the fields visible in the PDF file opened in Firefox

This is a screenshot of the bad positioning of the fields in the PDF file, visible when opened in Firefox. It is worth mentioning that even the positions of the fields in the last line that seem to be OK are wrong. That is because the place of month / year is reversed, suggesting that the calculation of the positions should be somehow reversed for RTL.
Comment 3 Miklos Vajna 2022-11-28 08:35:10 UTC
Yes, all content-control-specific PDF export code is in SwContentControlPortion::DescribePDFControl(), you found the correct place already. :-) Thanks for looking into this!
Comment 4 Commit Notification 2023-04-26 09:09:26 UTC
Hossein committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1466e2a58f40c869d8c2590a4479e85c093b3468

tdf#152246 Fix RTL content control field position

It will be available in 7.6.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.
Comment 5 Commit Notification 2023-05-01 11:01:05 UTC
Hossein committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/57f46a5a64f4e3bca2f0a52309ca7d201c1e2372

tdf#152246 Test position of RTL elements in PDF

It will be available in 7.6.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.
Comment 6 Commit Notification 2023-05-03 08:03:45 UTC
Hossein committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/df461b42126e440492fc919d2b1b2d6649962a90

tdf#152246 Fix RTL content control field position

It will be available in 7.5.4.

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.