Sunday 15 June 2014

Using Google Cloud Print in Android -


I'm using Google Cloud Print to print a pdf file with an Android project. I am storing the file in the Assets folder of the project and when I go to print it, I say "Doklam Missing".

This is my code

  public void steve print (see footage) {intent printintent = new intent (this, printDialogActivity.class); // Cant file, why? File file = new file ("/ property / steve.pdf"); PrintIntent.setDataAndType (Uri.fromFile (file), "Document / PDF"); PrintIntent.putExtra ("title", "Steve"); StartActivity (printIntent); Reference references = getApplicationContext (); Extreme text = "Sending to Google Cloud Print"; Int Period = Toast. LENNHH_LOG; Toast toast = toast Make text (context, text, duration); Toast.show (); }   

Any help is appreciated!

You use the wrong MIME type. It should be read:

  printIntent.setDataAndType (Uri.fromFile (file), "Application / PDF");   

It seems that you are using PrintDialogActivity, make sure that @JavascriptInterface annotations inside each method is PrintDialogJavaScriptInterface .

No comments:

Post a Comment