Code Monkey home page Code Monkey logo

rust-printers's People

Contributors

talesluna 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

Watchers

 avatar  avatar  avatar  avatar

rust-printers's Issues

incorrect result of PDF print_file

Directly print command works awesome but output paper has scrambled characters on it. How can we resolve this. Thank you.

NOTE: .txt files prints fine but non-latin characters appears different.

use printers;

fn main() {
    let samsung_printer = printers::get_printer_by_name("SEC001599CE908B").unwrap();
    
    samsung_printer.print_file("report.pdf");
    samsung_printer.print_file("readme.txt");
}

PDF result for example

IMG_20230503_114818

The tspl instruction cannot be parsed

use printers;

fn main() {
let printer = printers::get_printer_by_name("DL-888T").unwrap();
let mut data: Vec = vec![];
let mydata1 = String::from("S0056M1234-A001");
let msg1 = mydata1.into_bytes();

data.extend(b"SIZE 4,1\n");
data.extend(b"GAP 0,0\n");
data.extend(b"DIRECTION 1\n");
data.extend(b"HOME\n");
data.extend(b"CLS\n");
data.extend(b"TEXT 120,10,\"0\",0,1,1,\"");
data.extend(msg1);
data.extend(b"\"\n");
data.extend(b"BARCODE 120,50,\"128\",100,1,0,2,2,\"123456abcd123456\"\n");
data.extend(b"PRINT 1\r\n");

printer.print(&data, None).unwrap();

}The above is my code, please ask why after I run it, what is printed is the TSPL command, not the pattern formed by the command. We run it successfully on linux, but the problem I mentioned occurs on windows, can you know what is the problem

index out of bounds: the len is 0 but the index is 1

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 1', C:\Users\zhangby.cargo\registry\src\github.com-1ecc6299db9ec823\printers-1.0.2\src\windows.rs:27:37
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
error: process didn't exit successfully: target\debug\printer.exe (exit code: 101)

How to print image

how to print image. I try the print_file, but no work. just print text file.

printer.print_file("C:\\Users\\Administrator\\Documents\\01.jpg", None);

Specify page size

Hi,
Is it possible to specify the page size of the file to print? Or somehow pass parameters to the printer function?
Maybe I've simply overlooked something in the code...

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.