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

Html label design: Vector font, flexible label design, preview and print result 1:1 and more #84

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

LHBL2003
Copy link
Contributor

@LHBL2003 LHBL2003 commented Aug 15, 2024

I hope that this pull request will help many people.

The following issues and pull requests are covered.

Pull

#62

Issues

#73
#66
#43
#35
#33
#32
#82 (At least plugin netbox-inventory)

Fork

Link to my Fork Projekt: Klick HERE

Pull Request overview

Here are some improvements (if I haven't forgotten anything :D )

  • 01: The label can be specified in mm/inch.
  • 02: Whether printed on an A4 sheet or on a label, the content always has the defined size.
  • 03: The text is razor sharp, no matter how small it is. (Printing the HTML DIV element and its vector text. There is no need to margin the text as an image).
  • 04: All fonts supported by the browser can be used.
  • 05: The barcode can be printed right up to the edge of the label.
  • 06: The size of the QR code can be specified in mm/inch and is exactly the same size on the screen as on the printout.
  • 07: The font height can be specified in mm/inch.
  • 08: The distance between the QR code and the text can be specified in mm/inch.
  • 09: Horizontal and vertical representations are still supported.
  • 10: No scaling or similar must be bent in the print preview for the printout. Only one basic setting needs to be observed, then it will fit every label. See documentation.
  • 11: A logo variable can be stored in the Netbox Config, which can be used with the existing text_template function (Jinja2) without losing the overview.
  • 12: One or more label designs can be stored for a model (e.g. device or rack). This allows different label sizes or formats to be used.
  • 13: Only text labels are supported
  • 14: Only QR code labels are supported
  • 15: Text and QR code labels are supported
  • 16: The QR code can be specified higher than wide. (Sometimes looks nice, if you don't overdo it)
  • 17: You can design your own label from scratch.
  • 18: Unterstützt das ausrichten von Text im Textbereich (Hoizontal und Vertikal).
  • 19: Supports the Pugin netbox-inventory (https://github.com/ArnesSI/netbox-inventory)

image

@ALL and @cruse1977: I look forward to your feedback.


How to install the plugin for testing:

sudo su
source /opt/netbox/venv/bin/activate
pip uninstall netbox-qrcode
pip install git+https://github.com/LHBL2003/netbox-qrcode@HTML-Label-Design
systemctl restart netbox netbox-rq

!!! Do not forget to back up the configuration ;) and then customize it as desired !!!
nano /opt/netbox/netbox/netbox/configuration.py

More info about "How to install in forked plugin" Klick HERE

To reinstall the current release plugin:

sudo su
source /opt/netbox/venv/bin/activate
pip uninstall netbox-qrcode
pip install netbox-qrcode
systemctl restart netbox netbox-rq

Documentation of my branch version:

The following things are described here.

  • How to set up your label printer precisely incl. test from MS Word.
  • What to consider in Chrome & Firefox for the printer settings.
  • A separate link where each parameter is described with possible values.
  • A separate link where 12 example configurations are included.

To the manual: Klick HERE

All translations are from German to English. :)
But it's the will that counts.

@cruse1977
Copy link
Member

cruse1977 commented Aug 15, 2024 via email

@LHBL2003
Copy link
Contributor Author

I wanted to ask again if there is time and interest to implement such extensions as the two I suggested?

#80
#84

I know you all have a lot to do, but what's not fun is when someone invests a lot of time and the project fails. I'm thinking back to this project where he went to extreme lengths, including a YouTube video:

master...Jasonlin1198:netbox-qrcode:master

https://youtu.be/dtXzdX3FLoA?si=Ptje7KE4KETlPHYM

If you would like to keep the netbox-qrcode plugin very small like in the last years, please let me know. Because in the meantime I'm thinking about creating my own plugin version on this basis, e.g. Netbox-LabelPrint. Then you would have a mini version like this and something that might evolve into something bigger.

Don't be mad at me, but I would like to know where the journey is going. Before my suggestion ends up like Jasonlin1198's :-)

@cruse1977
Copy link
Member

cruse1977 commented Nov 17, 2024

hi @LHBL2003 priority is to push a v4.1 release out there (0.0.15) (alongside work through the deprecated lib and netbox v4.0.11 - 0.0.14) - this PR is not forgotten and yes we want to do far more with this - however in general we prefer 1 PR for 1 issue - whereas this is a number of changes hence it makes things very difficult to review seeing what section is solving what (even more so with loads of comments on existing code). This really needs to be introduced in a more granular fashion so its easier on users and to review.

How amenable are you to splitting this up to smaller PR's per issue ? - also I'd maybe leave logo till last, not sure I'm keen on large b64 encode things in config files, but things like multi-page, alignment etc we definitely want to do (and give you credit if you've done the work)

@LHBL2003
Copy link
Contributor Author

Hi @cruse1977, glad to hear it.

My goal with this PR was just to get the font crisp. Because scaling the text as an image always made it pixelated and ugly on the print. :)

For this reason, I made sure that this only happens in HTML, as you can specify millimeters or inches for the font here. This “vector” based solution ensures that the font remains of high quality. Because in Python it was impossible to get a high quality (I tried again and again for months).

Since two images had previously been assembled via Python, I could no longer use this principle. So I had to move the alignment of the objects, which was previously done in Python, to HTML.

So in this PR I tried not to destroy the parameters. And that all parameters continue to work.

Only after I was finished did I look at which issues could be marked as solved. Since these were rather side effects of the conversion. So it was not the intention to close issues.

Separating them into separate pull requests is therefore hardly possible, if at all, because they are all positive side effects of the conversion.

Question 1:
Can I make you a counter-suggestion?
My English is poor. But I can make you Youtube videos where I demonstrate all the improvements listed once as a test?

Question 2:
Yes, I can understand that with the picture. I can try to place the image with a fixed name in the directory where Netbox also stores the images. Then you can load it. Would you be okay with that?

jonathon2nd added a commit to fpm-git/netbox-docker that referenced this pull request Dec 3, 2024
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

Successfully merging this pull request may close these issues.

2 participants