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

Printing Images Estimation? #6

Closed
abdulla-khalil opened this issue Apr 5, 2021 · 8 comments
Closed

Printing Images Estimation? #6

abdulla-khalil opened this issue Apr 5, 2021 · 8 comments

Comments

@abdulla-khalil
Copy link

hello,

thanks for the hard work for this library.

Just wanted to ask if there is an estimation for the printing images feature? (hopefully iOS and Android)?
Does not have to be an accurate estimation.

regards

@tr3v3r
Copy link
Owner

tr3v3r commented Apr 6, 2021

Hello @abdulla-khalil,

I need this feature too actually, so I'll try to do my best to do it in the next few weeks ;)

@abdulla-khalil
Copy link
Author

will be keeping an eye on it. many thanks.

@tr3v3r
Copy link
Owner

tr3v3r commented Apr 6, 2021

I'll keep you posted on the progress 👍

@zchryst
Copy link
Contributor

zchryst commented May 3, 2021

Hey @tr3v3r - is there anything I can do to help with this?

@tr3v3r
Copy link
Owner

tr3v3r commented May 3, 2021

@zchryst Hi! Sorry for that but I have a lot of activities now ((
Actually to implement this functionality we need to change a bit the way of printing.

So instead of using binary data and external lib (esc-pos-encoder) we need to print using the printing methods provided by SDK itself (i.e. printText, align, printImage and etc.).

Because, if add just print image method, it will be just possible to print an image at the beginning or at the end of the print layout.

If you have capacity / possibilities to do it right now, I'd be really grateful.

But anyway I definitely will do it in the near future ( I hope :) )

@zchryst
Copy link
Contributor

zchryst commented May 3, 2021

@tr3v3r Yeah - I've got a little bit of capacity at this stage so I will see what I can do.

Just to make sure I'm clear on your vision, we simply export all the functions from the SDK, people can then use them as they need?

Or are you thinking about a chaining mechanism similar to esc-pos-encoder?

I imagine if we expose them initially, a second step could be some sort of chaining mechanism...

@tr3v3r
Copy link
Owner

tr3v3r commented May 4, 2021

@zchryst Yeap, I thought about the chaining mechanism. I thought to make something like:
1)

printing
.feed()
.printText(''text")
.printImage(require('./....')) // returns something like [['feed'], ['printText', 'text'], ['printImage', number]]

then pass the returned array into the native side and process received data by invoking corresponding methods of the SDK.

Looks a bit complex but it will allow us not to make a lot of calls through the Bridge

  1. Another way is just to invoke the desired method in sequence
await feed(); // invokes corresponding method of the SDK
await printText(''text");  // invokes corresponding method of the SDK
await printImage(require('./....'));  // invokes corresponding method of the SDK

PROS: Easy to implement
CONS: Every method will make a call through the bridge and should have its own error handling.
Also, we need to think about how to mark this sequence as a single task on the native side ( to prevent conflicts between printer operations )

@tr3v3r tr3v3r reopened this May 4, 2021
@tr3v3r
Copy link
Owner

tr3v3r commented Jun 9, 2021

Version 0.15.0 now supports image printing on Android and iOS! 🎉 🎉🎉🎉
Thanks to @zchryst and @echoneet

@tr3v3r tr3v3r closed this as completed Jun 9, 2021
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

3 participants