Bug 139237 - Convert to pdf on command line generates wrong pdf.
Summary: Convert to pdf on command line generates wrong pdf.
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
7.0.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:pdf
Depends on:
Blocks: Commandline PDF-Export User-Profile
  Show dependency treegraph
 
Reported: 2020-12-26 03:07 UTC by Hans Deragon
Modified: 2021-03-26 15:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
ODT source file. (23.08 KB, application/vnd.oasis.opendocument.text)
2020-12-26 03:07 UTC, Hans Deragon
Details
PDF file generated from CLI and for which the formatting is wrong. (20.27 KB, application/pdf)
2020-12-26 03:08 UTC, Hans Deragon
Details
PDF file generated from GUI and for which the formatting is right. (20.27 KB, application/pdf)
2020-12-26 03:08 UTC, Hans Deragon
Details
Cleaned file, all personal data removed; lines missing though. (425.76 KB, application/xml)
2021-03-26 14:10 UTC, Hans Deragon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Deragon 2020-12-26 03:07:18 UTC
Created attachment 168495 [details]
ODT source file.

libreoffice --headless --convert-to pdf --outdir . file.odt

...will generate file.pdf which will not visually match file.odt.

However, if from LibreOffice GUI one uses File -> Export As -> Export Directly as PDF, the generated output file is ok.

I expect the same output on the command line than in the GUI.

The file contains an embedded Calc spreadsheet which is the source of the problem.  If it is removed, the output is the same.

It used to work very well a year ago.

Version: 7.0.4.2
Build ID: 00(Build:2)
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-CA (en_CA.UTF-8); UI: en-US
Ubuntu package version: 1:7.0.4_rc2-0ubuntu0.20.04.2
Calc: threaded
Comment 1 Hans Deragon 2020-12-26 03:08:20 UTC
Created attachment 168496 [details]
PDF file generated from CLI and for which the formatting is wrong.
Comment 2 Hans Deragon 2020-12-26 03:08:53 UTC
Created attachment 168497 [details]
PDF file generated from GUI and for which the formatting is right.
Comment 3 Hans Deragon 2020-12-26 03:12:23 UTC
Clarification:

'If it is removed, the output is the same.'

..should have been written as:

'If (the Calc spreadsheet) it is removed, the output is then faithful to the ODT file.'
Comment 4 Hans Deragon 2021-03-04 17:42:02 UTC
Still occurring in:

Version: 7.1.1.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-CA (en_CA.UTF-8); UI: en-US
Ubuntu package version: 1:7.1.1~rc2-0ubuntu0.20.04.1~lo1
Calc: threaded
Comment 5 Timur 2021-03-05 11:42:18 UTC
This is clear report but I couldn't reproduce with LO 7.0.4.2 in GTK3. 
Since I have no other advice, please try with profile reset/delete/rename.
Comment 6 Hans Deragon 2021-03-25 13:21:56 UTC
Timur, you are right.  I have reset my LibreOffice profile and now it works!  I wonder what in the profile could possibly cause this bug to occur.  Another bug I guess?  But this bug probably does not happen to enough users to warrant efforts to fix it; there are so many more important things to work on LibreOffice, and the workaround / fix listed here is good enough.  I am marking this issue as RESOLVED / WORKSFORME.

This is how I have performed my LibreOffice profile reset:

mv ~/.config/libreoffice/4/user ~/.config/libreoffice/4/user-old
Comment 7 Aron Budea 2021-03-25 16:23:26 UTC
Hans, it could be interesting what piece of the profile causes this. If you have the time, it could be worth bisecting registrymodifications.xcu in your profile.

Ie. make a backup copy of the config file, then remove half of it, see whether the bug occurs, choose the half that remained or that was cut based on the result, and keep repeating until you're down to a single line, or a sufficiently small subset of lines.

Alternatively, you could share the file, however better make sure there is no personal information in it in that case.
Comment 8 Hans Deragon 2021-03-26 14:10:28 UTC
Created attachment 170762 [details]
Cleaned file, all personal data removed; lines missing though.

As suggested by Aron Budea, this is my registrymodifications.xcu (thus why it has '-cleaned' in its name, but will all the lines containing personal data removed.  Because the lines have been removed, it might be that the file is inconsistent and does not work; I have not tried it.

I do not have the time (unfortunately) to debug the problem.  Maybe someone can take a jab at it.
Comment 9 Aron Budea 2021-03-26 15:45:10 UTC
Thanks! I gave it a quick try, but the exported PDF looked as expected to me. Oh well, it was worth a try.