void SendToPrinter(int fromPage, int toPage)
        {
            bool    firstPass = true;
            DOCINFO di        = new DOCINFO();
            IntPtr  ptr       = new IntPtr();

            di.pDocName  = document.DocumentName;
            di.pDataType = "RAW";
            PrintDirect.OpenPrinter(printerName, ref ptr, 0);
            PrintDirect.StartDocPrinter(ptr, 1, ref di);
            for (int i = fromPage - 1; i < toPage; i++)
            {
                PrintDirect.StartPagePrinter(ptr);
                if (firstPass)
                {
                    Print(ptr, PageSetting());
                    firstPass = false;
                }
                Print(ptr, document.ToString(i));
                Print(ptr, "\f");
                PrintDirect.EndPagePrinter(ptr);
            }
            //Print(ptr, PageSetting());
            //Print(ptr, "****hello world\n");
            //Print(ptr, "****hello world\f");
            PrintDirect.EndDocPrinter(ptr);
            PrintDirect.ClosePrinter(ptr);
        }
        void Print(IntPtr ptr, string buf)
        {
            int count = 0;

            PrintDirect.WritePrinter(ptr, buf, buf.Length, ref count);
        }