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

Image command not working in printer #1

Open
ajayvraikar opened this issue Mar 14, 2024 · 1 comment
Open

Image command not working in printer #1

ajayvraikar opened this issue Mar 14, 2024 · 1 comment

Comments

@ajayvraikar
Copy link

I generated zpl image command using this library.
But its working in Zpl previewer
But in actual printer it's not working.
Please look into this.

@jesusbmx
Copy link
Owner

I generated zpl image command using this library. But its working in Zpl previewer But in actual printer it's not working. Please look into this.

Hello, how are you? At the moment, the library only generates ZPL code. I am planning to implement the print function. You can use another library like react-native-tcp-socket

import TcpSocket from 'react-native-tcp-socket';
import { Zpl } from "react-native-zpl-code";

// Create socket
const options = {
  port: 9100,
  host: '192.168.0.1', // printer
  reuseAddress: true,
};

const client = TcpSocket.createConnection(options, async () => {
  // Create a ZPL builder instance
  const zplBuilder = new Zpl.Builder();
  ...
  // Generate ZPL code
  const zplCode = await zplBuilder.build();

  // Write on the socket
  client.write(zplCode);

  // Close socket
  client.destroy();
});

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

2 participants