dymosoftware / dymo-connect-framework

DYMO Connect Framework for Javascript.
Other
88 stars 54 forks source link

Dymo Label labels don't work right with Dymo Connect #35

Open hunkydoryrepair opened 2 years ago

hunkydoryrepair commented 2 years ago

When printing labels created with Dymo Label, for fields that are set as "Shrink to Fit", Dymo Connect prints them in a maximum size font, which cuts off the text.

Here is the object info. It is supposed to shrink the text to fit the bounds, but it simply does not.

<ObjectInfo>
        <TextObject>
            <Name>Set Name</Name>
            <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
            <BackColor Alpha="0" Red="255" Green="255" Blue="255" />
            <LinkedObjectName />
            <Rotation>Rotation0</Rotation>
            <IsMirrored>False</IsMirrored>
            <IsVariable>False</IsVariable>
            <GroupID>-1</GroupID>
            <IsOutlined>False</IsOutlined>
            <HorizontalAlignment>Center</HorizontalAlignment>
            <VerticalAlignment>Middle</VerticalAlignment>
            <TextFitMode>ShrinkToFit</TextFitMode>
            <UseFullFontHeight>True</UseFullFontHeight>
            <Verticalized>False</Verticalized>
            <StyledText>
                <Element>
                    <String xml:space="preserve">MTG Set Name</String>
                    <Attributes>
                        <Font Family="Arial" Size="48" Bold="True" Italic="False" Underline="False" Strikeout="False" />
                        <ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
                    </Attributes>
                </Element>
            </StyledText>
        </TextObject>
        <Bounds X="223" Y="929" Width="2795" Height="784" />
    </ObjectInfo>

With Dymo Connect image

Reverting to the Dymo Label web service, this label appears correct. Using Dymo.WinApi.Win.Host.exe vs 1.3.2 it is unusable.

With Dymo Label image

dpolivy commented 2 years ago

DYMO Connect does not support Shrink to Fit, unfortunately. I've been pushing on this for a long time trying to get it added as we rely on it, too...

hunkydoryrepair commented 2 years ago

The readme states:

"DYMO.Connect.Framework has compatibility with DYMO Label Software and DYMO Connect Software."

So this is false? I guess change to "AlwaysFit" is the only option?

dpolivy commented 2 years ago

The readme states:

"DYMO.Connect.Framework has compatibility with DYMO Label Software and DYMO Connect Software."

So this is false? I guess change to "AlwaysFit" is the only option?

Well, the JS framework works with both the web service from DYMO Label Software and DYMO Connect, so that part is correct. However, the label template has differences between the two software versions, and unfortunately shrink to fit is not supported in DYMO Connect (yet). They try to automatically "translate" the DLS template into the DCD template format, but ignore the fields there aren't equivalents for. DCD does have auto fit, which will either grow or shrink text to fit, so it's not exactly the same.

Unfortunately, there's no way in the current JS framework that I'm aware of to easily determine whether the underlying software is DLS or DCD (that's another feature request I have with them), but really the only workaround is to have separate label templates for DCD and DLS.

hunkydoryrepair commented 2 years ago

This is the only one I've run into where it didn't translate. I think Auto Fit (alwaysfit in the xml) can be made equivalent by changing the size of the object. Since dealing just with single line text, we can make the maximum font size based on the extent of the rectangle, rather than the specified font size.

dpolivy commented 2 years ago

@hunkydoryrepair If you can make auto fit work for you, then you should be OK. In our case, we have variable amount of text that changes per-label so it can cause the font size to grow beyond what we would want in certain cases.

hunkydoryrepair commented 2 years ago

yes, we have variable text, too, and the AutoFit results in things being big when the text is too short. But as long as we do single line text, the height of the object limits it. As far as I know, you can't wrap text anyway.

There does seem to be a way to determine if DLS or DCD is running. If you load a label known to be a DLS label, you can test if it is a DCD label after running. If it is, then DCD is running, otherwise DLS is running. A bit of a kludge, but if you have both labels, load the DLS first, then if isDCDlabel returns true, load the DCD instead.

dpolivy commented 2 years ago

yes, we have variable text, too, and the AutoFit results in things being big when the text is too short. But as long as we do single line text, the height of the object limits it. As far as I know, you can't wrap text anyway.

Correct, no wrapping is what makes the lack of shrink to fit annoying.

There does seem to be a way to determine if DLS or DCD is running. If you load a label known to be a DLS label, you can test if it is a DCD label after running. If it is, then DCD is running, otherwise DLS is running. A bit of a kludge, but if you have both labels, load the DLS first, then if isDCDlabel returns true, load the DCD instead.

You are correct, that would work. Pretty annoying workaround for what should be a simple single API call, though 😄