Fix bug with broken pdf export of worksheet

Authored by sirgienko on May 31 2018, 10:56 AM.



In LatexEntry::updateEntry path to esp file is constructed invalid. This commit fix it. During debuging, it was found, that EpsRenderer don't check, that input is valid, at all. So, the commit also add checking, that input file is valid eps file, and warning message printing, if it is not true.

BUG: 330834
FIXED-IN: 18.04.2

Test Plan
  1. Create or open worksheet with Latex entries
  2. Export worksheet to pdf.
  3. Check, that latex entries in worksheet not broken
  4. Open the pdf file and check, that the pdf file is not broken and looks good

Diff Detail

R55 Cantor
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
sirgienko created this revision.May 31 2018, 10:56 AM
Restricted Application added a project: KDE Edu. · View Herald TranscriptMay 31 2018, 10:56 AM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
sirgienko requested review of this revision.May 31 2018, 10:56 AM

The fix is ok in general. Though, I'd prefer to have the already rendered eps-file as a member of LabelEntry object so it is always available and can be directly used for rendering, for printing and for saving without the need to involve the latex render every time again and again.

If I see it correctly, when a project is saved only LatexEntry::latexCode() is saved. Saving the string only requires re-running latex every time the project file is opened. Also, on systems without latex installation we'll fail to show such a project with worksheets having latex entries. It would be better to save the rendered images in the project file - either as base64 encoded image byte array directly in the xml file (similar to LabPlot's TextLabel;0adab041ea9156243a5bde10f79bc96daeff86d8$691) or as a png or eps file stored in the zip-archive similar to how this is already done in Cantor for rendered plots.

So, we can submit this change now to fix the bug 330834 but I think we should re-factor this a bit later to address the issues mentioned above.


why not to check the URL first with QUrl::isValid() either here or in LatexEntry::updateEntry() where?


this can be const reference.

sirgienko added inline comments.May 31 2018, 4:10 PM


sirgienko added inline comments.May 31 2018, 4:17 PM

QUrl::isValid() checks, that url is valid. But we also need check, that this url is a url of valid eps file. And spectre_document_is_eps does both verifications (but maybe I mistaken)

sirgienko updated this revision to Diff 35266.May 31 2018, 4:29 PM

Add const

sirgienko marked 2 inline comments as done.May 31 2018, 4:29 PM
asemke accepted this revision.Jun 1 2018, 7:06 AM
asemke added inline comments.

const QUrl& url

This revision is now accepted and ready to land.Jun 1 2018, 7:06 AM
sirgienko updated this revision to Diff 35352.Jun 1 2018, 3:54 PM

Update const

This revision was automatically updated to reflect the committed changes.