Bug 151552 - PDF import into writer messes up line justification
Summary: PDF import into writer messes up line justification
Status: RESOLVED DUPLICATE of bug 49705
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks: PDF-Import-Writer
  Show dependency treegraph
 
Reported: 2022-10-15 19:48 UTC by Eyal Rozenberg
Modified: 2022-11-04 10:30 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Writer-generated PDF document for observing the bug (13.09 KB, application/pdf)
2022-10-15 19:49 UTC, Eyal Rozenberg
Details
Screenshot of attachment 183066 imported into Writer (170.13 KB, image/png)
2022-10-15 19:56 UTC, Eyal Rozenberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2022-10-15 19:48:40 UTC
When opening a (Writer-created) PDF document with justified text, the justification is lost, and the resulting draw objects are aligned on the left only.

Reproduction instruction:

1. Create a new Writer document
2. Change the Default Paragraph Style to be justified
3. Enter a few lines of text (which are not themselves perfectly justified and require some spacing increases for justification).
4. Save the document as a PDF.
5. Open the PDF in Writer (not in Draw! Use the Writer PDF import filter)

Expected result: The opened document is justified, at least visually.

Actual result: Text is aligned to the left only, _unlike_ what we see in the PDF itself.
Comment 1 Eyal Rozenberg 2022-10-15 19:49:39 UTC
Created attachment 183066 [details]
Writer-generated PDF document for observing the bug

Instead of creating the PDF yourself, you may just open the attached file. It contains two paragraphs of "lorem ipsum" text.
Comment 2 Eyal Rozenberg 2022-10-15 19:56:53 UTC
Created attachment 183068 [details]
Screenshot of attachment 183066 [details] imported into Writer

Screenshot showing how the alignment after import is left-only.
Comment 3 V Stuart Foote 2022-10-15 20:53:36 UTC Comment hidden (obsolete)
Comment 4 Eyal Rozenberg 2022-10-15 21:28:11 UTC Comment hidden (obsolete)
Comment 5 V Stuart Foote 2022-10-16 07:08:19 UTC Comment hidden (obsolete)
Comment 6 Eyal Rozenberg 2022-10-16 16:27:50 UTC Comment hidden (obsolete)
Comment 7 V Stuart Foote 2022-10-16 19:23:37 UTC Comment hidden (obsolete)
Comment 8 Eyal Rozenberg 2022-10-16 21:49:48 UTC Comment hidden (obsolete)
Comment 9 Kevin Suo 2022-10-24 16:09:59 UTC
To have the "justified" text be justified in Writer pdfimport as well, we need to know how PDF specifies "justified alignment" as per the PDF specification. If we can find the pdf token defining the justified alignment (there should be one, but need to read the pdf specifications carefully to identify it), then we can add a line output to the (poppler based) xpdfimport binary, then handle that in the so called "emiting" process during import.

This is similar as to how do we handle bold, underline, etc. We read the PDF tokens, if we encounter the pdf token specifying that the text should be aligned justified, then we do that in our import process.

I think we really need to have this ticket short and provide as much useful information as possible, otherwise devs would not finish reading this ticket and this one will never be fixed.

May the irrelevant comments be tagged as "obsolete"?

I mark this to NEW as I see there is a bug here.
Comment 10 V Stuart Foote 2022-10-24 22:55:01 UTC
(In reply to Kevin Suo from comment #9)
> ...

> I think we really need to have this ticket short and provide as much useful
> information as possible, otherwise devs would not finish reading this ticket
> and this one will never be fixed.

a little history from the poppler side...

https://bugs.freedesktop.org/show_bug.cgi?id=55977
Comment 11 Heiko Tietze 2022-11-04 10:30:11 UTC

*** This bug has been marked as a duplicate of bug 49705 ***