Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReportDialog: replace xhtml2pdf with WeasyPrint. #2034

Closed
drew-parsons opened this issue Apr 16, 2022 · 8 comments
Closed

ReportDialog: replace xhtml2pdf with WeasyPrint. #2034

drew-parsons opened this issue Apr 16, 2022 · 8 comments
Assignees
Milestone

Comments

@drew-parsons
Copy link

qtgui/Utilities/ReportDialog.py uses xhtml2pdf to generate reports in pdf format.

xhtml2pdf is deprecated (no longer supported) and has operational problems, most egregiously it fails to handle non-latin1 characters, see xhtml2pdf/xhtml2pdf#11 . This places a bad restriction on the usability of sasview reports.

The xhtml2pdf documentation itself says to use WeasyPrint instead.

@butlerpd
Copy link
Member

@drew-parsons, just to clarify - By "deprecated" do you mean that xhtml2pdf is no longer going to be packaged in future Debian releases? Or that you have inside knowledge that the developer community has abandoned it (granted it seems quite small at the moment).

I note that the latest release was only 17 days ago (March 31, 2022) with no evidence on github or PyPi that the project is no longer supported?

@drew-parsons
Copy link
Author

My comment was based mainly on the comment that one of the xhtml2pdf upstream contributors themselves made, "xhtml2pdf is a very stale project", then going on to say "if you are doing something new, start off with WeasyPrint instead as suggested in the README". xhtml2pdf/xhtml2pdf#11 (comment)

Apart from that, xhtml2pdf/xhtml2pdf#11 was filed in 2011, eleven years ago and still not fixed. Why would you use a library that fails to render in chinese, or arabic, or, thai ? (it will fail unless you explicitly hack the font used). Especially when there is an alternative recommended by xhtml2pdf authors which does not have that same problem.

As for Debian support, the new version of xhtml2pdf switched to PyPDF3, which is not (yet) packaged for Debian.

@butlerpd butlerpd added this to the SasView 5.1.0 milestone Apr 23, 2022
@lucas-wilkins lucas-wilkins self-assigned this Jun 21, 2022
@lucas-wilkins
Copy link
Contributor

Weasyprint looks good. Its pretty big (I guess it needs to be to actually work well) and took a couple of minutes to download using anaconda.

@lucas-wilkins
Copy link
Contributor

Hmmm, the default install on anaconda is broken too. I'm going to look for a more minimal option.

@lucas-wilkins
Copy link
Contributor

pdfkit requires an external application

@lucas-wilkins
Copy link
Contributor

however, xhtml2pdf does not support svg images.

@lucas-wilkins
Copy link
Contributor

After playing with this a bit, I think xhtml2pdf is fine, will re-open if it becomes an issue.

@jergus48
Copy link

jergus48 commented Nov 5, 2023

After playing with this a bit, I think xhtml2pdf is fine, will re-open if it becomes an issue.

Hi I have really big problems with slavic characters when using xhtml2pdf. I think I tried everything and nothing worked. Could you please help me lol?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants