I solve by using Ls Printer
If printerName is empty or null, it will print to your default printer.
Currently, it works on Windows. Every printer should work.
using UnityEngine;
using System.Collections;
using System.Diagnostics;
using System;
using System.IO;
using LCPrinter;
using UnityEngine.UI;
public class LCExampleScript : MonoBehaviour {
public Texture2D texture2D;
public string printerName = "";
public int copies = 1;
public InputField inputField;
public void printSmileButton()
{
//print the texture2d using on
// Print.PrintTexture(texture2D.EncodeToPNG(), copies, printerName);*
Print.PrintTexture(texture2D.EncodeToPNG(), copies, printerName);
}
public void printByPathButton()
{
//direct path which fill in inputfield
Print.PrintTextureByPath(inputField.text.Trim(), copies, printerName);
}
}
it takes a small preview
System.Diagnostics.Process.Start("mspaint.exe", "/pt Assets\Resources"+files);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…