Click here to Skip to main content
16,021,288 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
<pre>    public void PrintLabelAction()
        {

            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "DYMO files |*.label;*.dymo|All files|*.*";

            if (openFileDialog.ShowDialog() == true)
            {
                var FileName = openFileDialog.FileName;
                // DymoSDK.App.Init();
                //Load label from file path
                dymoSDKLabel.LoadLabelFromFilePath(FileName);
                //Get image preview of the label
                dymoSDKLabel.GetPreviewLabel();
                //Load image preview in the control 
                var ImageSourcePreview = LoadImage(dymoSDKLabel.Preview);
                //Get object names list
                var LabelObjects = dymoSDKLabel.GetLabelObjects().ToList();

                int u = 1;
            }

            int copies = 1;
            // var SelectedPrinter  = DymoPrinter.Instance.GetPrinters();
            //DymoPrinter SelectedPrinter;
            var SelectedPrinter = DymoPrinter.Instance.GetPrinters();

            var name = SelectedPrinter.ToString();

            if (SelectedPrinter != null)
            {
                //Send to print
                //  int SelectedRoll;

                System.String SelectedRoll = "";

                if (name.Contains("Twin Turbo"))
                {
                    //var TwinTurboRolls = new List<string>() { "Auto", "Left", "Right" };
                    int rollSel = SelectedRoll == "Auto" ? 0 : SelectedRoll == "Left" ? 1 : 2; //DA MODIFICARE
                    DymoPrinter.Instance.PrintLabel(dymoSDKLabel, name, copies, rollSelected: rollSel);
                }
                else
                    DymoPrinter.Instance.PrintLabel(dymoSDKLabel, name, copies);

                //If the label contains counter objects
                //Update counter object and preview to show the incresead value of the counter
                var LabelObjects = dymoSDKLabel.GetLabelObjects().ToList();
                var counterObjs = LabelObjects.Where(w => w.Type == DymoSDK.Interfaces.TypeObject.CounterObject).ToList();
              //  if (counterObjs.Count > 0)
                {
                    foreach (var obj in counterObjs)
                    dymoSDKLabel.UpdateLabelObject(obj, copies.ToString());
                    UpdatePreviewAction();
                }
            }
        }
        /// <summary>
        /// Update the object value using the object name selected
        /// </summary>
        private void UpdateValueAction()
        {
            DymoSDK.Interfaces.ILabelObject SelectedLabelObject;
            string ObjectValue = "";

            SelectedLabelObject = DymoLabel.Instance.GetLabelObject(ObjectValue);
            //var SelectedObjectLabel;
            //string ObjectValue;
            //if (SelectedLabelObject.GetHashCode != null)
            {
                //Update label object value
                dymoSDKLabel.UpdateLabelObject(SelectedLabelObject, ObjectValue);
                UpdatePreviewAction();
            }
        }



What I have tried:

I found this code to print with dymo 550 in c#, but it doesn0t work...printer doesn't print..
Posted
Updated 28-Feb-23 6:27am
Comments
CHill60 28-Feb-23 12:20pm    
So you've "found" some code that doesn't work. Perhaps you should be asking where you found the code

1 solution

How do you expect us to diagnose the problem without access to your computer and printer, and without the benefit of having written the API? Heck, we can't even tell if there are labels in it!

This is what, the third time you've posted this? The answer doesn't change: talk to Dymo. It's their hardware, their software - they know it better than we do!
Or talk to wherever you copy'n'pasted that code from. They will know it better than us as well.

Seriously dude, looking at your QA history, you need to change the way you "do development" and start learning how to do things for yourself instead of expecting others to drag your potatoes out of the fire and fix the code you find ... 93 questions and 11 useless answers is the sign of a Help Vampire.
 
Share this answer
 
Comments
Richard Deeming 1-Mar-23 4:28am    
At least the third time; many previous reposts have been closed as such.

Some people just don't want to learn.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900