我用一台针式打印机来打印某种专用发票,发票是相相连的,我想每打完一份发票,打印自动将相连的下一份发票送到打印位置.注:我的打印机没有自定义纸张功能.

解决方案 »

  1.   

    回:shitianj(仲) 
    我的打印机是松下的一款很老的型号,具体型号不清楚.
      

  2.   

    自己调。我给你一个Api打印的方式的。。没有字的地方打空格
    [StructLayout( LayoutKind.Sequential)]
    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" ,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);// [ DllImport( "tty.drv",CharSet=CharSet.Unicode,ExactSpelling=true,
    //   CallingConvention=CallingConvention.StdCall )]
    // public static extern long Currentx(int x);
    //
    //        [ DllImport( "tty.drv",CharSet=CharSet.Unicode,ExactSpelling=true,
    //   CallingConvention=CallingConvention.StdCall )]
    // public static extern long Currenty(int y);
    }