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

[BUG] Error in display of SVG when creating reports - Weasyprint will need to be upgraded #4936

Closed
1 of 3 tasks
miggland opened this issue May 31, 2023 · 7 comments · Fixed by #5885
Closed
1 of 3 tasks
Assignees
Labels
bug Identifies a bug which needs to be addressed dependency Relates to a project dependency report Report/Label generation

Comments

@miggland
Copy link
Contributor

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

When creating a report with an SVG embedded in it via a link, there is a display error. It's our logo, and half of it is missing.

When I run Weasyprint 59.0 with the same source code on a different computer, the PDF looks like it should.

I believe this is caused by a bug in Weasyprint )Kozea/WeasyPrint#1864), which has been fixed in version 59.0.

At the moment, we can not update the version of Weasyprint to 59.0 because of an incompatibility with django-weasyprint, as described here:
fdemmer/django-weasyprint#71

Until this PR is merged in django-weasyprint, weasyprint can not be updated. For now, there is not InvenTree can do.

Workarounds:

  • Do no use <use ..:> tags in SVG
  • Convert SVG to another format, eg PNG

Steps to Reproduce

  1. Make SVG with <use ...> tags
  2. Use SVG in report template, eg with:
@top-left {
                width : 100%;
                height : 17mm;
                background-image: url("Logo.svg");
}
  1. Create a report in InvenTree
  2. Look for parts of SVG with <use ...> in the PDF vain

Expected behaviour

Same as with 59.0

Deployment Method

  • Docker
  • Bare metal

Version Information

Current master has:
weasyprint==54.3

Bug remains with
weasyprint==58.0

Relevant log output

No response

@miggland miggland added bug Identifies a bug which needs to be addressed report Report/Label generation dependency Relates to a project dependency labels May 31, 2023
@miggland miggland self-assigned this May 31, 2023
@matmair
Copy link
Member

matmair commented May 31, 2023

@miggland Thanks for the report! We are pinned to 54.3 due to problems between django-weasyprint and newer weasyprint that popped up.

How much of an impact has this error? I personally do not use svgs that are affected but sounds like something pretty severe. Do you have any idea how widely used use is?
From a quick glance at django-weasyprint it seems like a monkey patch would be pretty simple/small.

@miggland
Copy link
Contributor Author

miggland commented Jun 1, 2023

In my limited understanding, use is probably applied more often than necessary by drawing programs.

The impact is big if the SVG is affected, but since there is a workaround, it can be handled. Since there seems to be a fix on the way for django-weasyprint, I would wait for that and then check if the other problems are solved.

The issues with merging PDF pages should be fixed in the newest Weasyprint. The "good reason to update" may be this issue with SVGs.

Relevant issues, for reference:
#3607
#3528

@github-actions
Copy link
Contributor

This issue seems stale. Please react to show this is still important.

@github-actions github-actions bot added the inactive Indicates lack of activity label Jul 31, 2023
@miggland
Copy link
Contributor Author

Still relevant, but the required PR is not merged yet (not much happening in django-weasyprint?

@github-actions github-actions bot removed the inactive Indicates lack of activity label Aug 1, 2023
@miggland
Copy link
Contributor Author

The relevant PR is now merged. Unclear when the updated version will be released.

@matmair matmair mentioned this issue Aug 27, 2023
@github-actions
Copy link
Contributor

This issue seems stale. Please react to show this is still important.

@github-actions github-actions bot added the inactive Indicates lack of activity label Oct 17, 2023
@SchrodingersGat
Copy link
Member

not stale

@github-actions github-actions bot removed the inactive Indicates lack of activity label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies a bug which needs to be addressed dependency Relates to a project dependency report Report/Label generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants