狂急的问题!求远程打印如何设置字体大小!
代码如下:
public struct DOCINFO
{
[MarshalAs(UnmanagedType.LPWStr)]
public string pDocName;
[MarshalAs(UnmanagedType.LPWStr)]
public string pOutputFile;
[MarshalAs(UnmanagedType.LPWStr)]
public string pDataType;
}
public class PrintDirect
{
[DllImport( "winspool.drv ", CharSet = CharSet.Unicode, ExactSpelling = false,
CallingConvention = CallingConvention.StdCall)]
public static extern long OpenPrinter(string pPrinterName, ref IntPtr phPrinter,
int pDefault);
[DllImport( "winspool.drv ", CharSet = CharSet.Unicode, ExactSpelling = false,
CallingConvention = CallingConvention.StdCall)]
public static extern long StartDocPrinter(IntPtr hPrinter, int Level,
ref DOCINFO pDocInfo);
[DllImport( "winspool.drv ", CharSet = CharSet.Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
public static extern long StartPagePrinter(IntPtr hPrinter);
[DllImport( "winspool.drv ", CharSet = CharSet.Ansi, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
public static extern long WritePrinter(IntPtr hPrinter, string data,
int buf, ref int pcWritten);
//[DllImport( "winspool.Drv ", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode,
//SetLastError = true, ExactSpelling = true)]
//public static extern bool WritePrinter(IntPtr hPrinter, byte pBytes, int dwCount, ref int dwWritten);
[DllImport( "winspool.drv ", CharSet = CharSet.Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
public static extern long EndPagePrinter(IntPtr hPrinter);
[DllImport( "winspool.drv ", CharSet = CharSet.Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
public static extern long EndDocPrinter(IntPtr hPrinter);
[DllImport( "winspool.drv ", CharSet = CharSet.Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
public static extern long ClosePrinter(IntPtr hPrinter);
}
调用 :
string mhPrintData = string.Empty;
mhPrintData = "打印内容 ";
System.IntPtr lhPrinter = new System.IntPtr();
DOCINFO di = new DOCINFO();
int pcWritten = 0;
PrintDirect.OpenPrinter( "\\\\ " + 远程打印机IP+ "\\ " + 远程打印机名, ref lhPrinter, 0);
PrintDirect.StartDocPrinter(lhPrinter, 1, ref di);
PrintDirect.StartPagePrinter(lhPrinter);
PrintDirect.WritePrinter(lhPrinter, mhPrintData.ToString(), mhPrintData.ToString().Length, ref pcWritten);
PrintDirect.EndPagePrinter(lhPrinter);
PrintDirect.EndDocPrinter(lhPrinter);
PrintDirect.ClosePrinter(lhPrinter);
求解:如何设置 "打印内容 "的字体大小!!!
项目到期,情况紧急,求各位赐教!!!多谢了!!!!
[解决办法]
没写过..帮你顶
[解决办法]
参考vc的吧http://www.cfan.com.cn/school/pro/c/2006-07-11/1152572760d9841.shtml
[解决办法]
报表打印控件wsReport4.6
http://www.wave12.com/web/home.asp