-
Notifications
You must be signed in to change notification settings - Fork 51
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
420p label offset #80
Comments
It is very strange because it uses the same cartridge models as PnP (D1), so I assume they used the same printing header. Why would it work differently? However, if this is shown to be a consistent behavior on this model of label printers then I guess it could be a matter of adding an offset for this particular model. |
The unit has a little on-device keyboard and that works fine, the mode-switch-to-storage-enclosed "dymo mini" (or something like that) windows software also prints perfectly aligned. The official windows app from their site didn't see my labelprinter. How would I go about experimenting with offsets? I don't have the first clue about driver development. |
I can confirm the behavior for my 420p. Using the official windows app, it prints correctly. Using dymoprint under arch linux, I have the same offsets as described by @Mousketeer . |
@khrise I'm afraid we know pretty much the same about this code, as I'm not a contributor. Just someone who likes their PnP and tests new features. :) My understanding of Python is very limited, I can read it mostly but not contribute, unfortunately. |
As luck would have it my new 19mm tape came in this week, here are some tests: So various clues:
As for the material properties of the tapes:
An older version of the full windows software suite works perfectly. Any hints on where to start digging would be greatly appreciated :-) |
Excellent work! If you're able to calculate necessary offsets for each tape size, that would be half job done. :) D1 series cartridges (that fits PnP for example) appear to be centered regardless of tape size, which confirms your findings. Here's a photo of 9mm and 12mm I have. So clearly a table must be added, with offsets per each printer model and tape size. I suggest doing it in such a way that if a printer is not present in table, 0 offset is assumed, for maximum compatibility. I think this is the place to start: Here, Now, just before the printing is about to begin, here: dymoprint/src/dymoprint/dymo_print_engines.py Line 508 in 2476b17
label_matrix can be manipulated to implement offset.
I'm not familiar with good Python practices, but knowing other projects, a table with offsets per each printer and tape width should be stored in a separate constants file. For example here: I can offer a check whether your changes did not break the PnP compatibility. :) |
Now when I think about it, this will not solve the problem, sorry. Like I said, I can only speculate because I don't know anything more than any of you.
I fear that in order to print on your printers correctly, the printer must always think the tape is 19mm wide, and |
Mmh, ok, I'm getting somewhere. If I change the y-part of the position to 0 here: |
If you run |
If |
The vscode links don't work on my desktop, just saying. Yup, that's exactly why I later said my first comment isn't the best idea. The trick is to add correct amount of blank columns on front and back of existing matrix for each tape size. |
It seems like it works for me. Could the cutoff be a result of the adjustment you made?
|
Yes, definitly. Using the code from the repo, I get the same (correct) preview. However, I changed the y-offset in dymo_print_engines.py#L299 to 0, just to find out where I can adjust the erroneous offset in the printed labels (the original issue). With this change, the text on the label gets printed as shown above. And also the preview shows that the image already contains only half of the text. So, the image doesn't get rendered correctly, now we have to find how to fix that, in order to implement "switches" for the 420p. |
But, as @tomek-szczesny says, I might as well be on the wrong track. |
Taking a quick look, I'm quite skeptical of this line: dymoprint/src/dymoprint/labeler.py Line 33 in 2476b17
I'd try adding |
@khrise, I'll try to put everything I know now in simpler terms: Let's call As far as I can see, the canvas is sent to the printer verbatim with no changes. This means it has variable width. It appears both printer models behave the same, as indicated in the programming manual lined in the Here on page 15 we can read that the printer is made aware how many bytes per line will be sent using "Set Bytes Per Line" command, and that the right side of the label will be left blank. I'll share another picture where I use a lot of 9mm labels. The one on top has been printed using a handheld Dymo 160, and those on the lower end using PnP and dymoprint. The text is too low. If I used 6mm labels, I would probably notice this before. The solution: dymoprint/src/dymoprint/labeler.py Line 219 in 2476b17
You could try experimenting with adding +20 to dottab variable one line before and see if it makes any difference.
If yes, then all we need is a dottab table for each printer and each label size, instead of whatever method is in use right now. If not, then we know this function simply doesn't work and may be removed. After all, this is a documentation of a completely different Dymo product and not everything must be implemented in our label printers. |
And the winner is... @maresb ! :) At least, he pointed me to the relevant code. @tomek-szczesny : Increasing dotTab makes the problem even bigger, moving the text further down on the label. |
Well, it's not that simple, apparently. I will figure out appropriate |
I think this may take you a long time to figure out a proper setup for all tape widths and all supported printers, if you wish to do it by guessing which variable should be tweaked. I'm glad to know dottab manipulation works. Have you tried reducing it then? Maybe it's too big? Just don't make it negative. |
Hey, cool! Thanks a lot for all the experimentation @khrise! I don't think there are so many tape sizes, so maybe we just replace that formula with a lookup dictionary. |
@maresb , that's what I think, too. A lookup table per device with sane defaults (or fallback to the existing method). @tomek-szczesny , dotTab manipulation doesn't get us anywhere. The effective dotTab varies between 0 and 5 or so. Like I said, increasing it makes the situation worse, and we can't set it below 0, which we would need to get the text further "up". |
dottab manipulation does work, and it represents 8 dots, or ~1mm. Just like the documentation said. dymoprint/src/dymoprint/labeler.py Lines 210 to 215 in 2476b17
Since dottab cannot work with fractions it's not worth trying to solve the problem this way - we could end up with 0,5mm offset in the worst case. The solution - and I'm completely sure of this - is to expand canvas appropriately, after it's fully populated.
Because it artificially increases the label size in uncontrolled way. dymoprint/src/dymoprint/dymo_print_engines.py Line 166 in 2476b17
I mean, yeah it works for one printer and one tape size, but it breaks the math in the whole program. "bytes per line" loses its meaning, and builds up such a mess I swear I'll fork this project if you pull a hack like that. The best solution, that will always work per given printer head size, is to expand canvas up to the maximum tape size for the printer - by adding the right amount of empty lines on the bottom and top. The bottom side lines will move the content up, and the top lines must be added to round the dot number to full bytes. But given that my credibility in this thread has been thrown to trash and some of you want to guess how to proceed, despite asking for advice beforehand... go ahead, I won't spoil the fun. Good luck! |
@tomek-szczesny, I greatly value your insights and perspective, but please let's not have this tone. It is not constructive and is frankly quite offensive.
Also @khrise this is a collaboration and not a contest. I'm glad what I wrote was useful, but I think @tomek-szczesny has a fairly solid understanding here, better than mine. Back to the subject matter:
|
Didn't mean to sound aggressive at all, just wanted to get the message across, that either we seek the best working and maintainable solution the meritocratic way, or.. that other approach. I'm glad we agree. I think the To test the 420p maximum label width in pixels I can't think of any other way than experimenting. I created a pattern that can be used for testing that. A high resolution photo of the portion that didn't fit will unambiguously tell us how many pixels did fit on a print. In order to print it I would temporarily modify software to think that label is 20mm wide and doesn't do any image scaling whatsoever. I think Dymo doesn't crash when it receives data that doesn't fit on the print. Officially it has 180dpi resolution, which means 7,087 dots per mm. So it is confirmed: dymoprint/src/dymoprint/constants.py Line 72 in 2476b17
This could be true for all Dymos, I'm used to Japanese 8 dots per mm printers (203dpi). Unfortunately I've never seen a thermal printer that can report supported pixel width. Now, onto the actual offset problem: I suggest adding some code to dymoprint/src/dymoprint/dymo_print_engines.py Line 395 in 2476b17
Now ideally we would like to modify the picture before it gets converted into a byte array for dymo printer, but at the same time we have to know beforehand what printer and label size are we dealing with. So I think we would have to move things around a bit. The code generating label_matrix should be moved after the printer is detected, so right before the dymo labeler object is created:dymoprint/src/dymoprint/dymo_print_engines.py Lines 408 to 423 in 2476b17
dymoprint/src/dymoprint/dymo_print_engines.py Lines 505 to 506 in 2476b17
Then, we will create a bigger picture and paste the original The pseudocode would go like this:
|
Phew, that didn't work well, and I still need to recover a little, to be honest. Anyway, apart from all my hacking and guessing, I tried some of your suggestions, with some success. Does that look plausible?
It doesn't. However, I had to disable the check in the code.
This looks good and achieves good results. Only tested for 12mm tape until now. Using your pseude code from above, I found an offset of 4 to achieve good results for a 12mm tape. |
Oh no, I need to print that on a 19mm tape, right? |
Yup, we wanted to see the 19mm tape. Although I'm not entirely sure what we need that dot number for, @maresb? You also need to fool the code that 19mm tape is in fact bigger, like 21mm. Indeed, we'll have to take into account that your printer may have different firmware and stuff. Hopefully a look up table of offsets for each possible mode of operation will solve this problem once and for all, and for all of us. :) The interesting side effect we will achieve here is that 9mm and 6mm prints will be essentially without any margins. :)
That should become another issue, in my opinion, feel free to create it. I suspect this was the first functionality implemented, thus used to be mandatory. |
I bought the printer second hand, with a bunch of tapes, some original, some cheap compatibles. The printer itself doesn't look as if it has been used too much. But sure, something may be wrong with it. I guess even the tapes can get "old". So let's encourage @Mousketeer to do some printing, too. |
Thanks, this input is very valuable. It will serve us to build a preliminary LUT table, and the pattern is working as I hoped. I noticed that tapes age significantly. I only have one original Dymo tape and its adhesive leaves a lot to be desired. It just falls off. But it must be the oldest one I have (not sure if it wasn't the one I got from @maresb ?) |
Now I got a contributor badge, I am expected to give more informed answers. ;) @khrise, giving a sober look at your test pattern prints, there is definitely something going on with your 19mm and 12mm tape. The smaller sizes rendered single dots with no problem, even though the print head was obviously the same and operating in the same conditions. Today I'll attempt to implement what we are all waiting for, as one of the parties has been cancelled ;) |
I think it'd be helpful to add a single-pixel checkerboard part to the pattern. |
Feel free to expand existing procedure, but I can't see it being too helpful on top of what's in there already. I'm constructing a dictionary of dictionaries as we speak.. Lotta fun :D |
Like always, stuff is getting complicated. In order to render an image, we'll have to know tape size and printer model beforehand. So printer detection stuff will have to get executed first. |
💯 Really the preview should only hook in at the very end right before things are sent to the printer and convert the bytes back into pixels. |
63 insertions and 10 deletions in 2 hours. I truly suck at this. ;) Anyway, looks like the contraption is working. I created a table for 420p as well, but the final LUT values in This is the commit I'm taking about: c9ff02d19186ec2af8d06aa56e234e29a3032b8d Here is a test print, and old picture for comparison. All PnP tapes are centered along the common axis so this should look like that. |
That's a really bad metric to check. Results are better, and they look quite good! |
Ya, this is why I'd really like to support pixel fonts! |
Sorry, didn't have a single jiffy of time this week. (this is with version dymoprint 2.2.1.post1.dev21+g8d27f8d, and it crashes after printing the pattern) @tomek-szczesny I think the storage conditions significantly affect the aging, but also the type of label and the type of glue. I noticed (but not done any objective tests) that heating the underground a little before applying and pressing hard (in a point-like fashion, like a fingernail) helps. (obviously degrease the surface) |
Awesome! I'll give it a try in a bit.
Well, that would be the cause I like the most. :)
For the 19mm tape, I'm not too surprised that it doesn't bring the best results, since the thermal sheet is not rolled-in by the gear wheel mechanic, but rather only gets pushed out along with the label tape. I can easily imagine that this affects the pushout "pace". Maybe the tape sticks to the print head for a tiny moment after printing a vertical line. |
This is with the dymoprint 0.0.post1.dev250+g265c593 (from @tomek-szczesny's test-label branch (again on 19mm aliexpress nylon) I will re-try cleaning tomorrow and test with more tapes, because this just bad. |
Is there any advice on how to clean this thing? |
I have the brush, and it's sort of like some type of paper or microfiber cloth backed with plastic. I basically used the brush to delicately wipe any accumulated dust from the frighteningly delicate-looking print head. Does your model have a user's manual with any suggestions? |
Ah, indeed, there is a german manual in the box. Apparently, the 420p is also shipped with some sort of brush, which is no longer there. |
I don't think I got a brush with any Dymo, but the prints are fine so I wouldn't bother using it anyway. Hmm looks like another 420p with similar symptoms. Maybe that's just how they work. And as long as typical scenarios work well I wouldn't mind lack of full vertical lines. @Mousketeer it would be great if you could also try And I invite you and @khrise to try my branch that should more or less support 420p already. EDIT: I wanted to point out I always use unbranded cheap replacement tapes (Some $4 a piece). They work very well, and my only original Dymo tape doesn't, as I said before. But that one may be really old. |
BTW: GUI doesn't seem to work.
|
K, I think the GUI is fixed. |
I printed a bunch of labels throughout the weekend and I was very happy with the results. I think the differences in 12mm tape alignment in 420p are physical. I imagine it may not be pushed all the way to the bottom of the device and still work, if it supports 19mm tapes as well. I wasn't able to find any video online to see how it works for myself, nor any comments about this issue from other users. |
Hello, I was referenced to this issue/discussion from labelle-org/labelle#51 I was wondering what the current state is on this development. As I face the exact same challenge when implementing the LabelManager PC II. This printer has 24mm tape support. I've added the printer and the 24mm tape size and am able to print 24mm tape correctly. 12mm tapes are misaligned. (as known in this issue) https://github.com/FaBjE/labelle/tree/feature/addLabelManagerPCII If i understood correctly you need the test-pattern print to "calibrate" the lookup table. I'm not sure if you require other tape sizes as well. Let me know so I can print them. (I have 12mm on stock, one 9mm, but 6mm I need to order if required) |
Hi, First of all this repository is abandoned and all development happens in Labelle these days. I designed this test pattern and I can help you interpret it. In your case 128 px looks optimal. As this is the widest tape, no panning is required. I assume that the print head has 128 physical pixels. The checker pattern is for orienting on smaller tapes. The printer doesn't know what tape is installed and always prints data as it is, it doesn't handle panning on its own. On tapes smaller than the largest supported one, we tend to leave 1px margin on each side because these tapes aren't mechanically perfectly aligned. Ideally we'd love to see you carry out this procedure for all tape sizes, but we can't ask you to buy so much tape if you don't need it. At least one smaller than 24mm would be very helpful, as we could assume that all tapes >=12mm are aligned similarly across Dymo models. 24mm is an exception. Please create a new issue in labelle repo and tag me, I'll be happy to help. |
@tomek-szczesny , regarding your comment:
Can you please make sure this comment is written in the right place in the code? For future us, to understand what's going on when reading it. Thanks! |
I'll make sure to write a calibration manual, once printer model LUT is implemented in Labelle. |
The labels are printed offset to the bottom (when reading the text) of the label.
Attached is a photo of the result (tested with release v2.2.1 on Linux):
My 19mm tape ran out before I could test and is on order now, but I suspect that aligns correctly.
A possibility could be that the position of the tape is wrongly referenced:
-- The 6mm tape sits centered in the oversized housing, with spacers above and below.
-- The 12mm tape takes up the whole height of the cartridge.
-- The printhead thus sticks out on the side of the cartridge with the label.
Also attached is a schematic (apologies to your eyes)
(I lack any skill in printer driver development...)
The text was updated successfully, but these errors were encountered: