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

Add Label Template: Use with endless 62mm Brother printer rolls #14870

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

Galaxy102
Copy link
Contributor

@Galaxy102 Galaxy102 commented Jun 13, 2024

Description

I've added a label template for usage with endless Brother 62 mm label rolls (e.g. DK22212).
Because the label is printed with non-standard print flow (top-down instead of left-to-right), I've added a overridable function Label#getRotation() which can control TCPDFs Rotate format constructor argument (see https://stackoverflow.com/a/65296951/5885325). The default return value of this function is 0 in order to not break existing labels.

Here is a sample:
image
100001.pdf

There is no associated issue. There are no changed dependencies. This PR can be cherry-picked to develop directly.

Disclaimer: This PR is raised on behalf of Peerox GmbH, the company I work for.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I've tested this by generating a label using the Web UI via docker compose on Manjaro with Chromium 124.

The printer label format was created using sudo brpapertoollpr_ql600 -P Brother_QL-600 -n SnipeIT-62mmL -w 62 -h 37.

It is then printable via Print using system dialog -> Orientation = Landscape, Paper size = SnipeIT-62mmL.

Here is a picture of the result:
label

Checklist:

  • I have read the Contributing documentation available here: https://snipe-it.readme.io/docs/contributing-overview
  • I have formatted this PR according to the project guidelines: https://snipe-it.readme.io/docs/contributing-overview#pull-request-guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation -> there is very few documentation on labels
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works -> there are no tests for labels
  • New and existing unit tests pass locally with my changes -> there are no tests for labels

@Galaxy102 Galaxy102 requested a review from snipe as a code owner June 13, 2024 16:27
Copy link

welcome bot commented Jun 13, 2024

💖 Thanks for this pull request! 💖

We use semantic commit messages to streamline the release process and easily generate changelogs between versions. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix if it doesn't have one already.

Examples of commit messages with semantic prefixes:

  • Fixed #<issue number>: don't overwrite prevent_default if default wasn't prevented
  • Added #<issue number>: add checkout functionality to assets
  • Improved Asset Checkout: use new notification method for checkout

Things that will help get your PR across the finish line:

  • Document any user-facing changes you've made.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

Copy link

what-the-diff bot commented Jun 13, 2024

PR Summary

  • Introduction of the getRotation() method
    A new method named getRotation() has been introduced to the Label.php model file. This is an abstract method, a sort of placeholder method, which encapsulates operations that should be carried out, the specifics of which will be defined in a subclass.
  • Addition of specific label models
    Two new label models named TZe_62mm_Landscape.php and TZe_62mm_Landscape_A.php have been included in the Brother tapes directory. These files represent specific label layouts for Brother, a popular printer label brand.
  • Update with rotation parameter
    The View file for labels (Label.php) has been updated to accommodate the rotation parameter while launching TCPDF, the library we use to generate PDFs. This means that now, the system will account for label rotation in the final print.

@Galaxy102 Galaxy102 changed the title Add label template for use with endless 62mm Brother printer rolls Add Label Template: Use with endless 62mm Brother printer rolls Jun 13, 2024
@Galaxy102
Copy link
Contributor Author

I can't do anything against the failing Code Analysis check as far as I'm concerned, because the method preparePDF is abstract in Label and thus must be implemented in my custom label class. Is that correct?

@snipe
Copy link
Owner

snipe commented Jun 27, 2024

This looks great, thank you @Galaxy102!

@snipe
Copy link
Owner

snipe commented Jun 27, 2024

Can you possibly retarget to the develop branch, per the dev documentation?

…ted label PDF.

This is necessary when printing labels with width = label width.
Tested with QL-600. Set print mode to landscape.
@Galaxy102 Galaxy102 changed the base branch from master to develop June 28, 2024 08:02
@Galaxy102
Copy link
Contributor Author

Can you possibly retarget to the develop branch, per the dev documentation?

Done!

@snipe snipe merged commit 25ba50d into snipe:develop Jul 2, 2024
3 checks passed
Copy link

welcome bot commented Jul 2, 2024

Congrats on merging your first pull request! 🎉🎉🎉

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

Successfully merging this pull request may close these issues.

None yet

2 participants