1

Google クラウド プリントを使用してタブレットでフォームを印刷しようとしています。フォームに印刷したいロゴがあります。を使用して、画像ビューとhtmlテキストをWebビューに完全に表示することができました

 webView.loadDataWithBaseURL("file:///android_asset/",
            createHtmlSnippet(), "text/html", "UTF-8", null);

問題は、データを Google クラウド プリントに送信するときです。空の画像を除いて、テキストは問題ありません。

画像ビューを Google クラウド プリントに送信する方法を知っている人はいますか? これは私のコードの一部です、ありがとう..

画像のsrcを追加するときの行

 strVar += "<img src=\"file:///android_asset/logo.png\" width=\"360px\"/>";

「印刷」ボタンをクリックしたとき

          // save the file into storage
            String mPath = Environment.getExternalStorageDirectory()
                    + "/PrintText/";
            String mTimeStamp = null;
            try {
                mTimeStamp = new SimpleDateFormat("dd_MM_yyyy_HH_mm_ss",
                        Locale.getDefault()).format(new Date());

                File root = new File(mPath);
                if (!root.exists()) {
                    root.mkdirs();
                }
                File gpxfile = new File(root, mTimeStamp + ".txt");
                FileWriter writer = new FileWriter(gpxfile);
                writer.append(createHtmlSnippet());
                writer.flush();
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

            Intent i = new Intent(getApplicationContext(),
                    PrintDialogActivity.class);
            i.setDataAndType(
                    Uri.fromFile(new File(mPath + mTimeStamp + ".txt")),
                    "text/html");
            i.putExtra("title", getString(R.string.questionnare_pragnent)
                    + mTimeStamp);
            startActivity(i);
        }
    });
4

0 に答える 0