GithubHelp home page GithubHelp logo

ingoncalves / escpos-xml Goto Github PK

View Code? Open in Web Editor NEW
46.0 5.0 18.0 340 KB

JavaScript library that implements the thermal printer ESC / POS protocol and provides an XML interface for preparing templates for printing.

License: Apache License 2.0

TypeScript 97.61% JavaScript 2.39%
escpos xml handlebars printer template json momentjs numeraljs

escpos-xml's People

Contributors

blair2004 avatar captainjapeng avatar ingoncalves avatar williangoncalves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

escpos-xml's Issues

Loop in template

I want to use loop in template format.
Can anyone please tell me how it will achieve.
Thanks #

Electrode ReduxRouterEngine Error: TypeError: Cannot read property 'refreshOnCheckAuth' of undefined

I am getting above error on loading page
`//
// This is the client side entry point for the React app.
//

import React from "react";
import { render } from "react-dom";
import { routes } from "./routes";
import { Router, browserHistory } from "react-router";
import { createStore, applyMiddleware } from "redux";
//import { createStore } from "redux";
import { Provider } from "react-redux";
import { createLogger } from "redux-logger";
import { notify } from "react-notify-toast";
import "./styles/base.css";
import rootReducer from "./reducers";
import { showSpinner } from "./actions";
import { sessionService } from "redux-react-session";
import thunk from "redux-thunk";
import * as sessionApi from "./api/sessionapi";
require.ensure(["./sw-registration"], (require) => {
require("./sw-registration")(notify);
}, "sw-registration");
/**/

const validateSession = (session) => {
// check if your session is still valid
return true;
}
const renderApp = (store) => {
const showSpinnerOnLoad = () => {
store.dispatch(showSpinner());
};
render(

{routes(showSpinnerOnLoad)}
,
document.querySelector(".js-content")
);
};
window.webappStart = () => {
const initialState = window.PRELOADED_STATE;
const middleware = applyMiddleware(thunk, createLogger());
const store = createStore(rootReducer, initialState, middleware);

//const store = createStore(rootReducer, initialState);
sessionService.initSessionService(store,
{ refreshOnCheckAuth: true, redirectPath: "/login", driver: "COOKIES",validateSession });
sessionApi.login().then(response => {
const { token } = response;
if (token === 0) {
renderApp(store);
} else {
sessionService.saveSession({ token })
.then(() => {
sessionService.saveUser(response.data);
renderApp(store);
}).catch(err => err);
}
});
};
`

//package.json
{
"name": "ivdashboard",
"version": "0.0.1",
"description": "IVCargo Dashoboard ",
"homepage": "",
"author": {
"name": "Mitesh",
"email": "[email protected]",
"url": ""
},
"contributors": [
"Mitesh"
],
"files": [
"server",
"client",
"test"
],
"main": "server/index.js",
"keywords": [
"Dashoboard",
"Ivcargo"
],
"repository": {
"type": "git",
"url": "miteshivgroup/ivdashboard"
},
"license": "ISC",
"engines": {
"node": "^4.x.x || ^6.x.x || ^7.x.x",
"npm": ">= 3.x.x"
},
"scripts": {
"prestart": "gulp build",
"start": "if test "$NODE_ENV" = "production"; then npm run prod; else gulp dev; fi",
"test": "gulp check",
"coverage": "gulp check",
"prod": "echo 'Starting standalone server in PROD mode' & SET NODE_ENV=production & node ./lib/server/",
"heroku-postbuild": "gulp build"
},
"dependencies": {
"@ag-grid-community/all-modules": "^22.0.0",
"@ag-grid-community/react": "^22.0.0",
"@material-ui/core": "^3.9.2",
"babel-plugin-transform-node-env-inline": "^0.1.1",
"bluebird": "^3.5.0",
"boom": "^5.2.0",
"chart.js": "^2.6.0",
"core-js": "^3.4.7",
"electrode-archetype-react-app": "^3.1.6",
"electrode-confippet": "^1.5.0",
"electrode-csrf-jwt": "^1.2.1",
"electrode-react-ssr-caching": "^0.1.6",
"electrode-react-webapp": "^1.7.2",
"electrode-redux-router-engine": "^1.4.5",
"electrode-server": "^1.2.2",
"electrode-static-paths": "^1.1.0",
"events": "^1.1.1",
"get-parameter": "^1.0.8",
"lodash": "^4.17.4",
"material-ui": "^0.18.6",
"moment": "^2.24.0",
"query-string": "^4.3.4",
"react": "^15.6.2",
"react-chartjs-2": "^2.5.3",
"react-dom": "^15.6.2",
"react-flexboxgrid": "^1.0.1",
"react-html-table-to-excel": "^2.0.0",
"react-notify-toast": "^0.3.0",
"react-select": "^2.4.4",
"react-tap-event-plugin": "^3.0.3",
"redux-logger": "^3.0.6",
"redux-react-session": "^2.6.0",
"redux-thunk": "^2.2.0",
"require-at": "^1.0.0",
"wreck": "^12.2.2",
"xclap": "^0.2.39",
"xsh": "^0.3.7"
},
"devDependencies": {
"electrode-archetype-react-app-dev": "^3.1.6",
"gulp": "^3.9.1"
}
}

Simple example of use ?

Hello,
It seems to an interesting project but I can’t figure out how to make it work for a simple template.
Would you add an example of use in the repo ?

Thanks a lot !

Print in the same line with different aligns

Hello!
I'm trying to print in the same line but with different alignments, doing like this:

<?xml version="1.0" encoding="UTF-8"?>
<document>
  <line-feed />
  <align mode="left">
    <bold>
      <text size="2:1">TEXT ON LEFT</text>
    </bold>
  </align>
  <align mode="right">
    <bold>
      <text size="1:0">TEXT ON RIGHT</text>
    </bold>
  </align>
</document>

If I do this using <text-line> instead of <text> it works, but, obviously, the printer jumps one line.

Is it possible?

Thanks in advance.

Tests implementation

Unfortunately, the project doesn't have implemented tests yet. It's crazy but it's the truth.

Print html directly

I have a project where I need to build a web portal to print different labels and invoices. I have created a nice HTML div with styles and all which I am currently using for printing. But I need a kind of direct approach, and currently, it is going through the printing dialog where the user has to click on the print button to print the labels. I am thinking that your library can help me to bypass that. So thinking that, can I use my already existing div as input to your buffer? It is not exactly an issue, but kind of a suggestion or a question providing that I am missing something in the documentation.

And also please help me with the last part of your every example. You have mentioned sending the data to a stream like Bluetooth. Could you please tell me how I can do that?

XML Parser not preserving withspaces

I'm trying to print some text with padding on both sides but the text is trimmed. I've tried putting xml:spaces="preserve" but also not supported. Any suggestion what can I do to format text something like:

<text-line xml:space="preserve">(5 spaces)Medium</text-line>

Is this still maintained ?

I'm interested in this library. Is this library still maintained by someone?
Or do we have any fork that is in a good (not strictly) state?

buffer builder error

getting these errors:

ERROR in node_modules/escpos-xml/lib/buffer-builder.ts(9,19): error TS2554: Expected 2 arguments, but got 0.
node_modules/escpos-xml/lib/buffer-builder.ts(150,5): error TS2322: Type 'Buffer' is not assignable to type 'number[]'.
  Property 'push' is missing in type 'Buffer'.

I have fixed it by changing the return to return Array.prototype.slice.call(this.buffer.flush(), 0); in buffer-builder.ts line 150

UTF8 support

Hello! Thanks for this great project.

I need to use characters like "ç", "é", etc... When I print with that, I get something like "chinese" characters.

Is it possible with this lib? Or is this a limitation of my printer(I'm testing in a "Kinup KP-1019")?
Obs: I'm new with this.

Thank you!

Please release 1.0.1

there are some important fixes on branch master, can you please release a new version? thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.