Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Allow the User to print out information — Gideros Forum

Allow the User to print out information

paul_k_clarkpaul_k_clark Member
edited July 2012 in General questions
For my App I am wanting to produce one or more documents that the user can print out. As far as I know there is no way of printing from Android or IOS mobile phones so I thought the best way would be to email the user (from the phone) one or more pdfs to print out from a desktop pc.

So my question is how, in Gideros, can I send an email with attachments (I know about openURL but don't know how to send attachments) OR can anyone else think of another way to supply the user with information to print.
Tagged:

Comments

  • ar2rsawseenar2rsawseen Maintainer
    So this is a basic scheme to send and email:
    application:openUrl(“mailto:user@foo.com?subject=Test&body=Just a test”)
    To include an attachment into email you need to read the file, encode it in base64, split into smaller chunks to match RFC 2045 semantics, and include in header with specific mark.

    While you can read the file,
    encode into base64 http://alt.textdrive.com/svn/altdev/HTTP/base64.lua,
    etc,

    I doubt that you can set header's with openUrl.

    Another option to check is using SMTP protocol from Lua Sockets, but I haven't studied that yet
  • Thanks for the ideas

    @ar2rsawseen: Looks too complicated for openUrl. Might check out Lua Sockets and see what they can do.

    @___: I was hoping not to go down the plugin route since that would mean getting something to work on IOS and Android. Always a case of lots to do and not enough time to do it in :)
  • Thanks ar2rsawseen. Do you know if it is possible to create an SMTP connection to the local email handle on your phone without getting the user to enter any information. I assume localhost will work put not sure if the port is the same and if they would need to enter there username and password. I would rather not have to rely on an external email handlers.
  • ar2rsawseenar2rsawseen Maintainer
    There is a local email server on the phones? Really?
    I always thought that apps are used to handle emails with external email servers, for example gmail. And you simply set up one of the external servers as default to use for Email dialog. I really doubt phone handles emails.

    From my perspective what you want to do is to email the docs to the user. Thus you can use your own email server, or free gmail server (as far as I remember gmail supports external smpt connections), connect to it through SMTP and send an email with the doc file to the user email address. All that user will have to provide is the email address where to send the doc file
  • Sorry stupid thought of the day regarding local server (I blame the fact that its still earlyish in the morning here :) ). I was more meaning connecting using local information but got that confused with the server being local.

    Gmail is out because they have a limit of 200 emails a day (not very well known) for free accounts. If you go over they freeze your account for 24 hours. If you keep going over they shut you down. I think its to stop spam. I'll look into other free accounts.

    Thanks for your help
  • gorkemgorkem Maintainer
    Didnt know this 200 email limit, thanks for information.
  • ______ Member
    @gorkem @paul_k_clark

    This says something different :-?
    In an effort to fight spam and prevent abuse, Google will temporarily disable your account if you send messages to more than 500 recipients or if you send a large number of undeliverable messages. If you use a POP1 or IMAP2 client (Microsoft Outlook or Apple Mail, e.g.), you may only send a message to 100 people at a time. Your account should be re-enabled within 24 hours.
    People call me "underscore".
  • I'm sure it was two hundred for me but that was a couple of years ago so things could easily have changed. Either way it's not nice to find out the hard way when you rely on gmail being available.
  • ______ Member
    Yeah, I think I also remember it being 200.

    I'd probably setup my own server, and a simple PHP script that sends email with the data POST'ed to it, if I was going this way. Not sure how you would protect it from spammers though.
    People call me "underscore".
Sign In or Register to comment.