Android - Send html file to print app via intent, won't appear as html
I have an app I've been working on that has a feature that sends an html
file to an app to print it (the app in question is Brother iPrint&Scan).
The code to do this is as follows
final Intent emailIntent = new
Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Printable
Stuff");
// Send attachment (the html file).
Uri uri = Uri.fromFile(htmlFile);
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(emailIntent, "Send To"));
What this does is brings up a compatible chooser. Typically, this is gmail
and the brother iPrint&Scan app. Gmail will take it as an attachment, and
I can send it off and it appears fine. I can view it in a browser, the
html markup looks fine (and validates).
Now heres the catch... the brother iPrint&Scan app will take the html
file, but it just shows the html as text... odd. It won't render it at
all.
Whats even more disturbing is that I can share a page from my browser to
the app and it will display fine (so surely it can read and parse html?)
Am I doing something wrong here?
I've also tried:
emailIntent.setDataAndType(Uri.fromFile(htmlFile), "text/html");
Instead of the putting the extra in the intent... but then the brother
print app won't appear in the list at all (gmail does).
Any ideas?
No comments:
Post a Comment