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

Working library? #1

Open
DevanB opened this issue Jul 2, 2017 · 12 comments
Open

Working library? #1

DevanB opened this issue Jul 2, 2017 · 12 comments

Comments

@DevanB
Copy link

DevanB commented Jul 2, 2017

Hey! I'm curious if this is a working solution? I dropped it into a React app, plugged in my 450 Twin Turbo, put in the labels (and changed the sample XML to match those labels), turned on the Dymo printing service to port 41951 and tried to print a label. Unfortunately, it wasn't successful and I received an exception in the console:

POST https://localhost:41951/DYMO/DLX/Printing/PrintLabel net::ERR_INSECURE_RESPONSE
Uncaught (in promise) TypeError: Failed to fetch

Have you successfully printed a label with this (hopefully magnificent!) library?

Thanks!


Update: Oh, looks like I needed to turn on a flag in Chrome. No luck in Safari. I can now see that the library is finding my printer. Now debugging why it isn't actually printing, and how to configure which "side" to print out of.


Update #2: Sorry this is getting so long! I found where the Dymo SDK was updated to handle the insecure flag situation.

I also found that I need to pass a separate flag to handle the Twin Turbo model. This isn't in the library currently.

My only outstanding question is: are you still maintaining this library? If you would be interesting in parting way with it and the npm package, I would gladly welcome it! I am developing an application that needs to print to Dymo printers regularly, so maintenance of the library is not a problem.

@pguttikonda
Copy link

Hi - thanks for putting this together. I'm trying to run the example code and I'm getting a response of "undefined" from dymo.print(). Calling getPrinters(), I can see that my printer is correctly listed, but unable to actually print anything. I'm running my JS file from the command line. Any suggestions? Thanks!

@DevanB
Copy link
Author

DevanB commented Jul 31, 2017

@pguttikonda I ended up giving up on this library due to lack of response.

At some point, I'll writing something similar to this. Currently, I'm using Dymo library directly. This is working on Mac, but not on Windows, for me.

@pguttikonda
Copy link

@DevanB - Thanks for your response. I'm unable to get anything to work on a mac. Could you share how you got it to work on mac? Are you using it from the browser or command line, Framework JS vs. DLS web service? Thanks for your help.

@DevanB
Copy link
Author

DevanB commented Jul 31, 2017

@pguttikonda I'm using Dymo.label.framework (the JS source is like v2.0.2 or something). I've never used the command-line implementation.

@pguttikonda
Copy link

Hmm, I'm trying the same but I have had no luck printing - dymo.label.framework.printLabel returns a 200 but nothing gets printed. no job created in the printer queue as well. Can't figure out what the cause is.

@dsandor
Copy link
Owner

dsandor commented Aug 3, 2017

Sorry for the lack of response. My wife had twins recently and took me away from OSS. This library should work but you need to be running the Dymo Label Web service to make it work. All the nodejs code does is take the label XML and post it to the XML Web Service that is exposed from the DLWS service. That service does use https and it is a self signed cert so you probably need to make sure that is not causing your code to choke. There is a GetPrinters api call to the DLWS that returns back your printer name as well. It is possible that the printer name is different for your model. I did not have a lot of time to make this module generic. I was hoping for some PR's to make that happen. I do have this working with my printer and it works quite well. I will revisit it when I have a bit more time. Also you may try using PostMan to push your labels to the DLWS endpoint. That is how I tested this library and reverse engineered it.

@DevanB
Copy link
Author

DevanB commented Aug 3, 2017

@dsandor Thanks for the response, and congrats on the new births!

I'll give this another look. I believe my problem had to do with an option for TwinTurbo models, possibly. I'll try to get it all together and packaged into a PR for you to review.

Thanks again! 👍

@pguttikonda
Copy link

@dsandor - Congrats!

I could not get browser-less calls to DLWS to work - DLWS is referencing the calling window (amongst other things) and I could not get around that. I haven't spent meaningful time writing javascript, so that might be the reason. Invoking DLWS from the browser programmatically works fine and that's what I ended up going with

@rgesulfo
Copy link

rgesulfo commented Oct 3, 2017

Hi,

I tried this code:
`const
Dymo = require('dymojs'),
dymo = new Dymo();

dymo.print('DYMO LabelWriter 4XL', labelXml);

var labelXml = `

Landscape Shipping4x6 1744907 4 in x 6 in TEXT Rotation0 False False Left Middle AlwaysFit True False Test `;`

But the printer doesn't do anything.

Could you help me please?

Thank you.

@dev6rodn
Copy link

dev6rodn commented Jul 6, 2018

@rgesulfo I see two issues with your sample code.

  1. your labelXML variable should be declared before your call to the dymo.print() function.
  2. your labelXml variable appears to be invalid.

Here's a truncated version of what it should look like:

<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips" MediaType="Default">
  <PaperOrientation>Landscape</PaperOrientation>
  <Id>Address</Id>
  <PaperName>30252 Address</PaperName>
  <DrawCommands>
    <RoundRectangle X="0" Y="0" Width="1581" Height="5040" Rx="270" Ry="270"/>
  </DrawCommands>
  <ObjectInfo>
    <AddressObject>
      <!--  tags that describe the address object -->
    </AddressObject>
    <Bounds X="1802" Y="150" Width="2985" Height="1260"/>
  </ObjectInfo>
  <ObjectInfo>
    <ImageObject>
      <!--  tags that describe the image object -->
    </ImageObject>
    <Bounds X="331.2" Y="57.59995" Width="1463.672" Height="1435.2"/>
  </ObjectInfo>
</DieCutLabel>

You can generate the code above by creating a label in the Dymo Label software and saving it to your filesystem. Heads up... you can download the software for free but, in order to advance past the first few steps of the setup wizard, you'll need to have a printer available, either on your network or connected via USB.

@Greensahil
Copy link

Hey! I'm curious if this is a working solution? I dropped it into a React app, plugged in my 450 Twin Turbo, put in the labels (and changed the sample XML to match those labels), turned on the Dymo printing service to port 41951 and tried to print a label. Unfortunately, it wasn't successful and I received an exception in the console:

POST https://localhost:41951/DYMO/DLX/Printing/PrintLabel net::ERR_INSECURE_RESPONSE
Uncaught (in promise) TypeError: Failed to fetch

Have you successfully printed a label with this (hopefully magnificent!) library?

Thanks!

Update: Oh, looks like I needed to turn on a flag in Chrome. No luck in Safari. I can now see that the library is finding my printer. Now debugging why it isn't actually printing, and how to configure which "side" to print out of.

Update #2: Sorry this is getting so long! I found where the Dymo SDK was updated to handle the insecure flag situation.

I also found that I need to pass a separate flag to handle the Twin Turbo model. This isn't in the library currently.

My only outstanding question is: are you still maintaining this library? If you would be interesting in parting way with it and the npm package, I would gladly welcome it! I am developing an application that needs to print to Dymo printers regularly, so maintenance of the library is not a problem.

I installed the Dymo Webservices and I am also no longer getting the error that you mentioned above. However, the dymo is not printing anything at all and there are no error messages. Whta falg did you turn on?

@apenab
Copy link

apenab commented Apr 14, 2021

I was try to work with this library in ReactJs and get some errors then I decide develop my own solution. I never understood why this package not working in ReactJs ecosystem. The package that I currently use is this => https://github.com/apenab/react-dymo-hooks

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

No branches or pull requests

8 participants
@DevanB @dsandor @pguttikonda @rgesulfo @Greensahil @dev6rodn @apenab and others