Exemplo n.º 1
0
        /// <summary>
        /// 得到打印文件
        /// </summary>
        /// <param name="url"></param>
        /// <param name="type"></param>
        /// <param name="data"></param>
        private int getDoc(string url, string type, JObject data, string name, int num)
        {
            PrintDialog pd = new PrintDialog();
            PrintBLL    pl = new PrintBLL();

            pl.SetPrintProperty(pd);

            PrintBLL printbll = new PrintBLL();

            FlowDocument doc = printbll.LoadDocument(type, url, data);

            if (doc != null)
            {
                doc.PageHeight  = pd.PrintableAreaHeight;
                doc.PageWidth   = pd.PrintableAreaWidth;
                doc.PagePadding = new Thickness(50);
                doc.ColumnGap   = 0;
                doc.ColumnWidth = pd.PrintableAreaWidth;

                Dispatcher.BeginInvoke(new DoPrintMethod(DoPrint), DispatcherPriority.ApplicationIdle, pd, ((IDocumentPaginatorSource)doc).DocumentPaginator, name, num);
                return(0);
            }
            else
            {
                return(1);
            }
        }