Giter VIP home page Giter VIP logo

Comments (6)

KlustoR avatar KlustoR commented on May 23, 2024 1

I've went through the source code a bit and found a possible solution.
An Implementation of $cmd -> isAvailableAs('LineBreak') and edit the height of the corresponding image, and add the required 8 bytes of null as needed.
Is this something that could work ?
I dont know how to edit .pbm images height tho.

from escpos-tools.

mike42 avatar mike42 commented on May 23, 2024

I think that escimages is behaving correctly here, as the spacing is not part of the images. Ran the input through esc2html, picture illustrates me selecting the whitespace in the browser, and this should be more true to the print-

image

There are a few approaches you could use here-

  • OCR images separately
  • add space when the images are stitched together (not sure how to do this with ImageMagick, but that would be the right place to do it)

Long term, we need a reliable way to convert receipt files to raster images. HTML has the most accurate output we get right now, so wkhtmltoimage is a real option.

from escpos-tools.

A-Rotsaert avatar A-Rotsaert commented on May 23, 2024

I've found the solution, after your reply i googled a bit and found this topic https://superuser.com/a/290679 that suggest using +append instead of -append when using imagemagick's convert. I will try that soon and let you know.

from escpos-tools.

KlustoR avatar KlustoR commented on May 23, 2024

I've tried changing the -append to +append but results where not as expected.
I've also tried using wkhtmltoimage, but it doesn't run headless (what is a must for my needs).
Then i tried using xvfb but resulted in a low quality picture.

Also, if i'd OCR the images separately it becomes to slow for my purpose.
Any idea's ? :)

from escpos-tools.

mike42 avatar mike42 commented on May 23, 2024

This command is currently only going to to extract individual images, so I think you should initially add the whitespace back with ImageMagick. This documentation should hopefully get you started.

I think we could solve this properly in one of several ways:

  • implement a flag in escimages (eg, --include-blank-lines) to additionally output a 24px tall, 1px wide image for each line of text encountered. This is similar to what you are suggesting (low difficulty).
  • Implement a flag in escimages (eg --preserve-formatting) to assemble the output into a single image for OCR users (medium difficulty).
  • Implement a totally separate command, eg esc2image, which renders entire receipts to images, just like esc2html (high difficulty).

Thoughts?

from escpos-tools.

KlustoR avatar KlustoR commented on May 23, 2024

I reckon any of those options would do the trick, first one seemingly the easiest, i would go for that.

from escpos-tools.

Related Issues (20)

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.