Collections of react hooks to handle the Dymo LabelWriter web service.
npm install --save react-dymo-hooks
or
yarn add react-dymo-hooks
Return the status of DYMO Label Web Service
- port: The port of running DYMO Label Web Service. (For defualt is the 41951)
- status:
"initial" | "loading" | "success" | "error"
Status of DYMO Label Web Service.
Returns the available DYMO Labelwriter Printer
- statusDymoService: The status of DYMO Label Web Service. (Use the status returned fot the
useDymoCheckService()
hook) - modelPrinter: The model of label writer printer.
- port: The port of running DYMO Label Web Service. (For defualt is the 41951)
Object containing:
- statusFetchPrinters:
"initial" | "loading" | "success" | "error"
Status of loading printers. - printers: The list of available DYMO Printer.
- error.
Render Label
- statusDymoService: The status of DYMO Label Web Service. (Use the status returned fot the
useDymoCheckService()
hook) - labelXML: XML file.
- port: The port of running DYMO Label Web Service. (For defualt is the 41951)
Object containing:
- statusOpenLabel:
"initial" | "loading" | "success" | "error"
Status of open label. - label.
- error.
Inside the root directory project
- Switch to the directory
example/
yarn install
ornpm install
yarn run start
ornpm run-script start
import {useDymoOpenLabel, useDymoCheckService} from "react-hooks-toolbox";
const DymoLabelPreview = () => {
const statusDymoService = useDymoCheckService();
const {label, statusOpenLabel, errorOpenLabel} = useDymoOpenLabel(statusDymoService, xmlFile);
if (label) {
return <img src={"data:image/png;base64," + label} alt="dymo label preview" />;
} else {
return null;
}
};
MIT © apenab