我正在使用带有 android 项目的谷歌云打印来打印出一个 pdf 文件。我将文件存储在项目的资产文件夹中,当我去打印它时说“文档丢失”。
这是我的代码
public void stevePrint(View view) {
Intent printIntent = new Intent(this, PrintDialogActivity.class);
//Cant find file, why?
File file = new File("/assets/steve.pdf");
printIntent.setDataAndType(Uri.fromFile(file), "document/pdf");
printIntent.putExtra("title", "Steve");
startActivity(printIntent);
Context context = getApplicationContext();
CharSequence text = "Sending to Google Cloud Print";
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
任何帮助表示赞赏!