dymosoftware / DCD-SDK-Sample

DYMO Connect SDK Samples
Other
60 stars 26 forks source link

doesn't work with .net 6 #51

Open toristorii opened 2 years ago

toristorii commented 2 years ago

With .NET 6, DymoSDK.App.Init() fails with the following exception:

Could not load file or assembly 'DYMO.LabelAPI, Version=1.4.3.37, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'

I saw a similar issue here for .net 5. Is .net core going to be supported? Or are we forced to continue to use the old Dymo Label SDK 8? (which does appear to work)

binn commented 2 years ago

I am also having this issue with .NET 5

eljayg commented 2 years ago

@dymosoftware any update on this?

dymosoftware commented 2 years ago

DymoSDK nuget is currently targeting netstandard2.0 as of today. It will provide multi targeting for net5, net6 in future release. We don't have timeline for the project yet.

eljayg commented 2 years ago

Cross-referencing same issue in #16

DaveSlinn commented 2 years ago

DymoSDK nuget is currently targeting netstandard2.0 as of today. It will provide multi targeting for net5, net6 in future release. We don't have timeline for the project yet.

Is there anything we can do to help? Why not leverage the power of GitHub and the open source community to assist with this migration?

eljayg commented 2 years ago

@dymosoftware please escalate this issue. .NET 6 and .NET Core 3.1 are the only Microsoft supported versions right now.

.NET and .NET Core release lifecycle

Supported versions

The following table tracks release dates and end of support dates for .NET and .NET Core versions.

Version Original Release Date Latest Patch Version Patch Release Date Support Level End of Support
.NET 6 November 8, 2021 6.0.4 May 10, 2022 LTS November 12, 2024
.NET Core 3.1 December 3, 2019 3.1.24 May 10, 2022 LTS December 13, 2022

Out of support versions

The following table lists .NET Core versions no longer supported.

Version Original Release Date Latest Patch Version Patch Release Date End of Support
.NET 5 November 10, 2020 5.0.17 May 10, 2022 May 10, 2022
.NET Core 3.0 September 23, 2019 3.0.3 February 18, 2020 March 3, 2020
.NET Core 2.2 December 4, 2018 2.2.8 November 19, 2019 December 23, 2019
.NET Core 2.1 May 30, 2018 2.1.30 August 19, 2021 August 21, 2021
.NET Core 2.0 August 14, 2017 2.0.9 July 10, 2018 October 1, 2018
.NET Core 1.1 November 16, 2016 1.1.13 May 14, 2019 June 27, 2019
.NET Core 1.0 June 27, 2016 1.0.16 May 14, 2019 June 27, 2019

Ref: .NET and .NET Core Support Policy

brian-douglas commented 1 year ago

@dymosoftware the samples are also too old and require the .NET 4.6.1 targeting pack which is not available from MSFT. We really need this to work in .NET Core 6. We need it for a blazor app.

toristorii commented 1 year ago

@dymosoftware Are you planning on supporting the people that write software for your label printers? Or would you prefer we software developers look into other label printing solutions?

brian-douglas commented 1 year ago

We switched to Brother. So far, so good.

csobsidian commented 1 year ago

Does the Brother solution require additional software installs like the Dymo solution (Dymo Connect)? I too am looking for a label writing Blazor solution.

brian-douglas commented 1 year ago

We didn't need any external software. It's much simpler to work with.

mschulz531 commented 1 year ago

Can't believe that Dymo is not supporting .NET Core 6 (or even .NET Core 5).

Looks like Brother is the way to go. Goodbye Dymo

mschulz531 commented 1 year ago

We didn't need any external software. It's much simpler to work with.

Brian, can you provide any details about how you are using Brother software? I looked into this and the Brother SDK is 10 years old and only appears to support .NET Framework 4.6.

I'm shocked that there do not appear to be any label printer SDKs that support any current .NET technologies.

Thanks for any help you can provide.

brian-douglas commented 1 year ago

The thinking is to treat the Brother printer just like any other printer, but you have to send it a “page” with a very small custom page size. We have a Winforms app which uses RDLC reports to send labels. It’s straightforward if you adjust the page size in the report itself. Just pretend it’s just any old printer.

Another interesting observation: in this dymo GitHub, nobody from the company (@dymosoftware, hint hint) seems to be reading (or caring about) the conversation going on here. Another reason to switch, IMO.

toristorii commented 1 year ago

They certainly don't seem to realize that software developers represent hundreds if not thousands or tens of thousands of individual printer sales. shrug

DaveSlinn commented 1 year ago

@brian-douglas suggestion is exactly how I ended up solving the problem for the Dymo labeller. I no longer use the Dymo software or SDKs. My code creates HTML which it converts to PDF and then sends to the printer. It's not very efficient, but it runs "fast enough".

using SelectPdf;
using System;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
...
        public class LabelFields
        {
            public string Name { get; set; }
            public string Address { get; set; }
            public string OrderName { get; set; }
        }

        public static void PrintLabel(this LabelFields labelFields)
        {
            var html = Resources.label_template;

            html = html.Replace("{CUSTOMER_NAME}", labelFields.Name);
            html = html.Replace("{CUSTOMER_ADDRESS}", labelFields.Address.Replace("\r\n", "<br />"));
            html = html.Replace("{ORDER_NUMBER}", labelFields.OrderName.Replace("#", ""));

            var converter = new HtmlToPdf(420);

            converter.Options.PdfPageSize = PdfPageSize.Custom;
            converter.Options.PdfPageCustomSize = new SizeF(252f, 79.2f);
            converter.Options.PdfPageOrientation = PdfPageOrientation.Landscape;

            var doc = converter.ConvertHtmlString(html, "/");

            var stream = new MemoryStream();
            doc.Save(stream);
            var stream2 = new MemoryStream(stream.ToArray());

            PrintPDF("DYMO LabelWriter 450", "Plain", 1, stream2);

            doc.Close();
        }

        private static bool PrintPDF(string printer, string paperName, int copies, Stream stream)
        {
            try
            {
                var printerSettings = new PrinterSettings
                {
                    PrinterName = printer,
                    Copies = (short)copies,
                };

                var pageSettings = new PageSettings(printerSettings);

                foreach (PaperSize paperSize in printerSettings.PaperSizes)
                {
                    if (paperSize.PaperName == paperName)
                    {
                        pageSettings.PaperSize = paperSize;
                        break;
                    }
                }

                using (var document = PdfiumViewer.PdfDocument.Load(stream))
                {
                    using var printDocument = document.CreatePrintDocument();
                    printDocument.PrinterSettings = printerSettings;
                    printDocument.DefaultPageSettings = pageSettings;
                    printDocument.PrintController = new StandardPrintController();
                    printDocument.Print();
                }

                return true;

            }
            catch (Exception)
            {
                return false;
            }
        }
doughayman2 commented 1 year ago

Any solutions on this yet? I'm developing VB.net apps in Visual Studio 2022 (Net 6.0; Net Framework 4.8+), and get the following error when attempting to execute the following SDK code:

Imports DymoSDK.Implementations Imports DymoSDK.Interfaces DymoSDK.App.Init() Dim dymoSDKPrinter = DymoPrinter.Instance

    Dim fullpath As String = System.IO.Path.GetFullPath("d:\label.label")
    Dim dymoSDKLabel = DymoLabel.Instance
    dymoSDKLabel.LoadLabelFromFilePath(fullpath)

    Dim LabelTextObject1 As DymoSDK.Interfaces.ILabelObject
    LabelTextObject1 = dymoSDKLabel.GetLabelObject("NameOfLabel")
    dymoSDKLabel.UpdateLabelObject(LabelTextObject1, "ValueOfLabel")

    If dymoSDKPrinter.PrintLabel(dymoSDKLabel, ItemId.Text, 1, False, False, 0, False, False) Then
        MsgBox("Printed !", vbInformation)
    End If

**"System.IO.FileNotFoundException: 'Could not load file or assembly 'DYMO.CrossPlatform.Common, Version=1.4.3.37, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'"**

I've loaded the following packages:

Dymo.Connect.SDK V1.4.3.37 NetStandard.Library V2.0.3 SkiaSharp V2.88.3 SkiaSharp.Views V2.88.3

The following link implies that my environment is supported by the Dymo SDK:

https://www.nuget.org/packages/DYMO.Connect.SDK/#supportedframeworks-body-tab

Anybody have any ideas on this?

Thanks in advance.

77vetter1 commented 1 year ago

@DaveSlinn do you have an example template I can use to try this with?

DaveSlinn commented 1 year ago

Sure.

<html>

<head>

    <style>
        body {
            margin: 0px;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            /*transform: translateX(-10%) rotate(-90deg);*/
        }

        .customerName {
            line-height: 1.1;
            font-weight: bold;
            font-size: 24px;
            min-width: 21 0px;
        }

        .customerAddress {
            line-height: 1.1;
            font-size: 16px;
        }

        .orderNumber {
            font-size: 56px;
        }
    </style>

</head>

<body>

    <div style="margin: 5 0 0 10">

        <div style="float: left;">
            <div class="customerName">
                {CUSTOMER_NAME}
            </div>
            <div class="customerAddress">
                {CUSTOMER_ADDRESS}
            </div>
        </div>

        <div class="orderNumber" style="vertical-align: bottom;">
            <span><sup>#</sup>{ORDER_NUMBER}</span>
        </div>

    </div>

</body>

</html>
freakshock88 commented 1 year ago

@DaveSlinn thanks for your example. I've tried running your sample in a .NET 6 console app but can't get it to build. What NuGet packages are you using exactly? And do you know if it's possible to run this on Linux?

DaveSlinn commented 1 year ago

Here are the NuGet packages my app has that are used for printing labels.

    <PackageReference Include="PdfiumViewer.Native.x86_64.v8-xfa" Version="2018.4.8.256" />
    <PackageReference Include="PdfiumViewer.Updated" Version="2.14.4" />
    <PackageReference Include="Select.HtmlToPdf.NetCore" Version="22.1.0" />

I run it on Windows, so not sure - you'd probably have to check the individual NuGet packages you're referencing.

77vetter1 commented 1 year ago

We were having trouble using the sdk and found if the Dymo Connect service is not started by a user with Admin privileges we could not print. But once the service is started with a user who has admin privileges then we were able to print labels using the SDK. Not sure if it is particular to our corporate policy's but wanted to share this is what we found.

Eli1995 commented 1 year ago

Any solutions on this yet? I'm developing VB.net apps in Visual Studio 2022 (Net 6.0; Net Framework 4.8+), and get the following error when attempting to execute the following SDK code:

Imports DymoSDK.Implementations Imports DymoSDK.Interfaces DymoSDK.App.Init() Dim dymoSDKPrinter = DymoPrinter.Instance

    Dim fullpath As String = System.IO.Path.GetFullPath("d:\label.label")
    Dim dymoSDKLabel = DymoLabel.Instance
    dymoSDKLabel.LoadLabelFromFilePath(fullpath)

    Dim LabelTextObject1 As DymoSDK.Interfaces.ILabelObject
    LabelTextObject1 = dymoSDKLabel.GetLabelObject("NameOfLabel")
    dymoSDKLabel.UpdateLabelObject(LabelTextObject1, "ValueOfLabel")

    If dymoSDKPrinter.PrintLabel(dymoSDKLabel, ItemId.Text, 1, False, False, 0, False, False) Then
        MsgBox("Printed !", vbInformation)
    End If

**"System.IO.FileNotFoundException: 'Could not load file or assembly 'DYMO.CrossPlatform.Common, Version=1.4.3.37, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'"**

I've loaded the following packages:

Dymo.Connect.SDK V1.4.3.37 NetStandard.Library V2.0.3 SkiaSharp V2.88.3 SkiaSharp.Views V2.88.3

The following link implies that my environment is supported by the Dymo SDK:

https://www.nuget.org/packages/DYMO.Connect.SDK/#supportedframeworks-body-tab

Anybody have any ideas on this?

Thanks in advance.

I have the same problem...I have an application in c++ that calls a library in c# and I have this error, how can I solve?

luis-aguirree commented 1 year ago

Same issue here, I tried also connect via COM but I can'f find de DYMO.DYMOaddin anymore, the only way that I could handle this issue was using the Javascript sdki but is useless when your project also includes tablets android.

jspanoeddson commented 11 months ago

same issue, ****"System.IO.FileNotFoundException: 'Could not load file or assembly 'DYMO.CrossPlatform.Common, Version=1.4.3.37, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified using dot net 7

queueslikely commented 8 months ago

@dymosoftware Are there any plans to support .net core in the near-ish future?

We were considering paying the DYMO own-brand label tax because of how much easier this SDK made things, but it's not ideal when it (and the DYMO Connect software) come with a version of SkiaSharp with the libwebp vulnerability.

A minor shame as well when everything else of ours is .net core :(

adam-b-jones commented 7 months ago

Any updates at all on this? Receiving the same error as others, "Could not load type of field 'DymoSDK.Implementations.DymoPrinter:PrintCategory' (1) due to: Could not load file or assembly 'DYMO.CrossPlatform.Common, Version=1.4.4.21, Culture=neutral, PublicKeyToken=null' or one of its dependencies."

Using .NET 7, it's a Blazor WebAssembly project. Not having any luck getting it to work.

fruitmans commented 4 months ago

Same issue and i was unable to fix it for me. Even the WPF sample project doesn't work in Visual Studio 2022. This WPF sample project gives me the same error.

The availability of the SDK was of great value for the tooling in which i use is. Now we want to upgrade to support the 550 and all its functions but i am unable to build the project anymore.

@dymosoftware: is there any update on this topic or is it time to switch to another printer which do provide support?