dymojs icon indicating copy to clipboard operation
dymojs copied to clipboard

Working library?

Open DevanB opened this issue 7 years ago • 12 comments

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.

DevanB avatar Jul 02 '17 15:07 DevanB

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!

pguttikonda avatar Jul 31 '17 18:07 pguttikonda

@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.

DevanB avatar Jul 31 '17 19:07 DevanB

@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.

pguttikonda avatar Jul 31 '17 19:07 pguttikonda

@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.

DevanB avatar Jul 31 '17 19:07 DevanB

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.

pguttikonda avatar Jul 31 '17 20:07 pguttikonda

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.

dsandor avatar Aug 03 '17 14:08 dsandor

@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! 👍

DevanB avatar Aug 03 '17 15:08 DevanB

@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

pguttikonda avatar Aug 03 '17 15:08 pguttikonda

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.

rgesulfo avatar Oct 03 '17 21:10 rgesulfo

@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.

dev6rodn avatar Jul 06 '18 15:07 dev6rodn

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?

Greensahil avatar Aug 20 '19 02:08 Greensahil

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

apenab avatar Apr 14 '21 13:04 apenab