jack-carling / dymo-connect

NPM package for printing DYMO labels
1 stars 1 forks source link

How to load .dymo files #1

Closed RicardoViteriR closed 1 year ago

RicardoViteriR commented 1 year ago

hello, is this library able to open .dymo files?

jack-carling commented 1 year ago

Hi! There's no functionality of the library to open .dymo files at the moment. However, they're basically XML files so if you're running the package from a node backend you can use the native File System module.

const Dymo = require('dymo-connect')
const fs = require('fs')

const data = fs.readFileSync('./path/to/file.dymo', 'utf-8')
Dymo.printLabel('Your LabelWriter', data)

If you're solely doing it in a frontend application I would look into the FileReader of the File API https://developer.mozilla.org/en-US/docs/Web/API/FileReader

Edit: closing this as won't fix for now since the two methods vary depending on if you use the library in a frontend or backend.

RicardoViteriR commented 1 year ago

Hi @jack-carling, I was testing some XMLs that I copied from a .dymo file. The printer did not print anything. Here is the sample QR XML https://gist.github.com/RicardoViteriR/1cee0f795c8f446c2d2320f3eed24d80 wondering what may be wrong.

jack-carling commented 1 year ago

Do you have the software installed? DYMO Connect for mac / windows is required for the printing to work since the package calls the web SDK. You can download it from Dymo's official website. https://www.dymo.com/support?cfid=user-guide

I see no issues with your xml, I was able to use the renderLabel() method, so I doubt there would be an issue printing it.

RicardoViteriR commented 1 year ago

Hmm I will try again. I got it to work by implementing the javascript sdk placing it in the script tags.