Has anyone gotten AirPrint to work with corona? I’m trying to print from an iOS app. I know Rob showed a tutorial on printing with iOS but that was with images. I thought I might can print from the webview from it does not have a print method either. I’ve given up on printing from Android. There is such a demand to print from apps now and no one wants to support it.
The tutorial I did was for Enterprise subscribers. You cannot print from Corona SDK. Now the Enterprise tutorial should also print PDF files. This tutorial seems to confirm that most people will generate a PDF and print it, but there are a few other options:
But you cannot create a PDF with corona also right? You would have to pass the data to a server, generate the PDF and then retrieve it to print. Unless I’m missing something.
Since you have to have Enterprise to print a PDF you can use native to make a PDF to use. I don’t know how to print a webView nor do I believe you could get access to the one Corona SDK uses anyway.
The tutorial I did was for Enterprise subscribers. You cannot print from Corona SDK. Now the Enterprise tutorial should also print PDF files. This tutorial seems to confirm that most people will generate a PDF and print it, but there are a few other options:
But you cannot create a PDF with corona also right? You would have to pass the data to a server, generate the PDF and then retrieve it to print. Unless I’m missing something.
Since you have to have Enterprise to print a PDF you can use native to make a PDF to use. I don’t know how to print a webView nor do I believe you could get access to the one Corona SDK uses anyway.
There are two options. On iOS you can use the Activity plugin which gives you access to the default printing option when you tap an app’s Send To button (sharing). For Enterrpise users, we did a tutorial that included a bonus “How to print” option.
The Activity plugin can take a text string, an image, and/or a hyper link. I suppose you could try and pass a PDF in as an image, though that’s not been proven. But all this said, what would you print? We can’t easily create PDF’s. The utility of what you would print is kinda minimal.
Thank you very much for your reply. I’m basically trying to print a full-screen screenshot. I could do the screenshot in the webview via html2canvas but when I press the print-button in the webview nothing happens.
I guess I would somehow have to overlay a native corona print button at the right time in order for it to work?
I don’t know about printing webViews. But what you might be able to do is have a button in your app that would take the webView (as long as it’s from a website, not a local file) and run it through the SafariView plugin. It might have a print button as it’s a full page widget.
Slightly tangential to the discussion but it is possible to generate PDFs in Corona (none enterprise) using the lua port of a PDF library (no native components required!). It’s at: luaFpdf.zip - Google Code
It works very well indeed, and it can pull background images in, on which you can overlay text using grid coordinates, and so you have some proforma style capability. We’ve used v1.7 quite a bit now.
The difficulty we still have is printing (grr) - even after the advent of the activity plugin!
It seems that printer service does not respond to (‘see’) the url type item. Apple’s documentation says the print service will respond to NSURL where it refers to a local url, but there seems to be no way in Corona to ‘phrase a url’ to a generated PDF residing in the sandbox’s Documents directory - shame - so near and yet so far!
I don’t seem to be able to con it with a PDF as an image as you suggest trying
But also, and more worrying, is that a url to a web PDF does not trigger the printer service - according to the Corona and the Apple documentation this should should at least work as is an NSURL being passed through (supposedly).
I did get it to work with a real image (an icon from app as per the example), but when this printed the image was clipped and the scaling awful.
I remain puzzled at the practical usefulness of the activity plugin in respect of printing.
Would be a relief If I’d made an error somewhere as this would be a darm useful feature - but I simply copied the example code and used the item table mentioned above.
There are two options. On iOS you can use the Activity plugin which gives you access to the default printing option when you tap an app’s Send To button (sharing). For Enterrpise users, we did a tutorial that included a bonus “How to print” option.
The Activity plugin can take a text string, an image, and/or a hyper link. I suppose you could try and pass a PDF in as an image, though that’s not been proven. But all this said, what would you print? We can’t easily create PDF’s. The utility of what you would print is kinda minimal.