public void CreatePhoto() { int resWidth = Screen.width; int resHeight = Screen.height; Texture2D snap = new Texture2D(Screen.width, Screen.height); snap.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0); snap.Apply(); byte[] image = snap.EncodeToJPG(); Destroy(snap); texture = snap; string sDir = Application.dataPath + "/Screenshots1"; if (!Directory.Exists(sDir)) { Directory.CreateDirectory(sDir); } string sFileName = sDir + "/" + string.Format("{0:F0}", Time.realtimeSinceStartup * 10f) + ".jpg"; Debug.Log(sFileName); alamat = sFileName; File.WriteAllBytes(sFileName, image); Debug.Log("Photo ini: " + sFileName); //// PrinterPlugin.print(texture, false, PrinterPlugin.PrintScaleMode.FILL_PAGE); }
public void print() { // _result=GetComponentInChildren PrinterPlugin.print(_texture, false, PrinterPlugin.PrintScaleMode.FILL_PAGE); }