Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / How do you print to an external printer in either Android or Windows

Author
Message
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 19th Jul 2021 09:59
Hi all,

I am going to start a project that requires receipts to be printed to an external printer connected via USB. Ideally I would like to do this in Android but can look at Windows too.

Any help would be appreciated as the project depends on this ability...

Thanks
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Jul 2021 11:22
I think the only printing command is PrintImage, which i think will generae a "select printer"dialog.
I think the best approach might be to;
1. Create or find a utility that does what you want
2. Generate the file in your AppGameKit app
3. Use RunApp() to run the utility passing it the filename
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 19th Jul 2021 12:28 Edited at: 19th Jul 2021 12:32
I have not had the need for this, so I have not played around with it.

But, is there any way you could render that text to an image?

Then you could print it with that print image command, right?

One solution might be to incorporate QR codes into the process... receipt data to QR code.

That way you could print out the receipts with the print image, since the QR codes are saved as an image.

There are many apps out already (and you can code it in AppGameKit too) to read the values/data of QR codes.

Not exactly the best idea for legibility of the printed version, but it should be a simple work around to implement.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 22nd Jul 2021 22:39
You could also construct an html file that has your receipt info on it, then open the file with the OpenBrowser() command, then print from the browser. We do this with our season ticket receipts, and by using html code we can add fancy graphics and cool formatting.
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 22nd Jul 2021 22:59 Edited at: 22nd Jul 2021 23:08
Quote: "You could also construct an html file"

this is ideal (and relatively simple) in my book, using the device's built-in print dialogue. the company i work for finally went this route (tho we're still using some ibm telnet emulator from the 70's? on lots of things (similar to this)... but can now "print" a lot of it to email or as html attachments).

@Rudders, do you already have a set filetype for receipts?
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]

Login to post a reply

Server time is: 2024-04-19 23:33:43
Your offset time is: 2024-04-19 23:33:43