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

Label text looks weird if multiple labels are printed. #3528

Closed
2 of 3 tasks
miggland opened this issue Aug 12, 2022 · 9 comments · Fixed by #3539
Closed
2 of 3 tasks

Label text looks weird if multiple labels are printed. #3528

miggland opened this issue Aug 12, 2022 · 9 comments · Fixed by #3539
Labels
bug Identifies a bug which needs to be addressed report Report/Label generation
Milestone

Comments

@miggland
Copy link
Contributor

Please verify that this bug has NOT been raised before.

  • I checked and didn't find similar issue

Describe the bug*

When printing multiple labels to a PDF, the text includes spacing. When printing a single PDF, this does not occur.

Example with the built-in part label template Barcode Part Label - Simple part label with Code128 barcode:
One label created:
image

Two labels created:
image

Example with a stock item template I made. These use the same template, but in one I call:

Output with one single label:
image

Output with multiple labels:
image

The fact that some lines are missing is not a problem, that is due to the template. However, where is the spacing from?

Steps to Reproduce

  1. Print label with text for one part.
  2. Print label with text for several parts at once.
  3. Compare, and see that it looks weird in one case.

Expected behavior

The output should look the same regardless of whether I create multiple labels at once or not.

Deployment Method

  • Docker
  • Bare metal

Version Information

Version Information:

InvenTree-Version: 0.9.0 dev
Django Version: 3.2.15
Commit Hash: 139e059
Commit Date: 2022-08-10
Database: postgresql
Debug-Mode: True
Deployed using Docker: True
Active plugins: []

Relevant log output

No response

@miggland miggland added bug Identifies a bug which needs to be addressed question This is a question triage:not-checked Item was not checked by the core team labels Aug 12, 2022
@miggland
Copy link
Contributor Author

I tried seeing what happens by going to debug mode, but that unfortunately puts the second label on top of the second label so doesn't really help..

@nwns
Copy link
Contributor

nwns commented Aug 12, 2022

I am seeing the same sort of issue with 0.8.1 running on bare metal (Debian
Bullseye (11)). Singly or in pairs seems to work fine.

image (2)
image (1)
image

My system information is not copy and paste able for some reason.
image

``` arrow==1.2.2 asgiref==3.5.2 Babel==2.10.3 bleach==5.0.0 blessed==1.19.1 Brotli==1.0.9 certifi==2022.6.15 cffi==1.15.0 charset-normalizer==2.0.12 cli-helpers==2.2.1 click==8.1.3 configobj==5.0.6 coreapi==2.3.3 coreschema==0.0.4 cryptography==3.4.8 cssselect2==0.6.0 defusedxml==0.7.1 diff-match-patch==20200713 Django==3.2.14 django-allauth==0.51.0 django-allauth-2fa==0.10.0 django-cleanup==6.0.0 django-cors-headers==3.13.0 django-crispy-forms==1.14.0 django-error-report==0.2.0 django-filter==22.1 django-formtools==2.3 django-import-export==2.5.0 django-js-asset==2.0.0 django-maintenance-mode==0.16.3 django-markdownify==0.9.2 django-money==2.1.1 django-mptt==0.11.0 django-otp==1.1.3 django-picklefield==3.1 django-q==1.3.9 django-redis==5.2.0 django-sql-utils==0.6.1 django-sslserver==0.22 django-stdimage==5.3.0 django-user-sessions==1.7.1 django-weasyprint==2.1.0 django-xforwardedfor-middleware==2.0 djangorestframework==3.13.1 et-xmlfile==1.1.0 fonttools==4.33.3 gunicorn==20.1.0 html5lib==1.1 idna==3.3 importlib-metadata==4.12.0 itypes==1.2.0 Jinja2==3.1.2 Markdown==3.3.7 MarkupPy==1.14 MarkupSafe==2.1.1 oauthlib==3.2.0 odfpy==1.4.1 openpyxl==3.0.10 pdf2image==1.16.0 pendulum==2.1.2 pgcli==3.4.1 pgspecial==1.13.1 Pillow==9.1.1 pkg_resources==0.0.0 prompt-toolkit==3.0.30 psycopg2==2.9.3 py-moneyed==1.2 pycparser==2.21 pydyf==0.2.0 Pygments==2.12.0 PyJWT==2.4.0 pyphen==0.12.0 python-barcode==0.14.0 python-dateutil==2.8.2 python-fsutil==0.6.1 python3-openid==3.2.0 pytz==2022.1 pytzdata==2020.1 PyYAML==6.0 qrcode==7.3.1 rapidfuzz==0.7.6 redis==3.5.3 requests==2.28.0 requests-oauthlib==1.3.1 sentry-sdk==1.6.0 setproctitle==1.3.2 six==1.16.0 sqlparse==0.4.2 tablib==3.2.1 tabulate==0.8.10 tinycss2==1.1.1 uritemplate==4.1.1 urllib3==1.26.9 wcwidth==0.2.5 weasyprint==55.0 webencodings==0.5.1 xlrd==2.0.1 xlwt==1.3.0 zipp==3.8.0 zopfli==0.2.1 ```

@SchrodingersGat
Copy link
Member

if len(outputs) > 1:

I would imagine it is due to this line here. Weird. I'll try to reproduce on my end.

@SchrodingersGat
Copy link
Member

I can reproduce pretty easily. The issue may be one of the following:

  1. Something about the HTML template which is causing issues around page-breaks
  2. An upstream issue with weasyprint

If I had to put money on it, probably 1

@matmair
Copy link
Member

matmair commented Aug 13, 2022

@nwns
Question: Are you experiencing the copy problem on ther server info or about screen?
Note: Only the about screen contains copy buttons

@nwns
Copy link
Contributor

nwns commented Aug 13, 2022

I would tend to agree that the issue is related to how Inventree merges the separate labels.

In my experimentation trying to figure out what the cause was I tried replacing the substitution with static text and the text came out fine.

@matmair That would be what is it. I was on the server information screen not the about screen.

@SchrodingersGat
Copy link
Member

@nwns I tried out a few different ways of merging the pages but all with the same outcome.

If you can work out the key to getting the rendering right please let us know

@matmair matmair added report Report/Label generation and removed question This is a question triage:not-checked Item was not checked by the core team labels Aug 14, 2022
@matmair matmair added this to the 0.9.0 milestone Aug 14, 2022
SchrodingersGat added a commit to SchrodingersGat/InvenTree that referenced this issue Aug 15, 2022
- Revert to 54.3
- Fixes inventree#3528
SchrodingersGat added a commit that referenced this issue Aug 15, 2022
* Pin weasyprint version

- Revert to 54.3
- Fixes #3528

* Simplify label printing for multiple pages

* Simplify PDF generation for multiple report outputs

* Add content wrapper div for base label template

- Allows more extensibility
SchrodingersGat added a commit to SchrodingersGat/InvenTree that referenced this issue Aug 15, 2022
* Pin weasyprint version

- Revert to 54.3
- Fixes inventree#3528

* Simplify label printing for multiple pages

* Simplify PDF generation for multiple report outputs

* Add content wrapper div for base label template

- Allows more extensibility

(cherry picked from commit 87e7112)
SchrodingersGat added a commit that referenced this issue Aug 15, 2022
* Pin weasyprint version

- Revert to 54.3
- Fixes #3528

* Simplify label printing for multiple pages

* Simplify PDF generation for multiple report outputs

* Add content wrapper div for base label template

- Allows more extensibility

(cherry picked from commit 87e7112)
@miggland
Copy link
Contributor Author

Fast, as usual @SchrodingersGat ! Nice work.

Works for me (after invoke update so that the weasyprint version is corrected).

@SchrodingersGat
Copy link
Member

Works for me (after invoke update so that the weasyprint version is corrected).

You can also append the old weasyprint version into your plugins.txt file - this way it will override the default version :)

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 report Report/Label generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants