Esempio n. 1
0
		public String PrintStadtWienAdressEttiketten(List<Object> CollectionOfClassesToPrint,
	String TargetFileName, String HeadLine, String Orientation = "Portrait")
			{
			if (TargetFileName.Contains('{'))
				throw new Exception("TargetFileName = \"" + TargetFileName + "\"");

			CommonPrinter<PrintFrameLessPage> FrameLessPrinter = new CommonPrinter<PrintFrameLessPage>();
			FrameLessPrinter.PageFrameProp.PagePadding = new Thickness(0, 0, 0, 0);
			FrameLessPrinter.PagePadding = new Thickness(0, 0, 0, 0);
			FrameLessPrinter.PageFrameProp.LeftIconMargin = new Thickness(30, 0, 0, 0);
			FrameLessPrinter.PageFrameProp.RightIconMargin = new Thickness(0, 0, 30, 0);
			FrameLessPrinter.PagePadding = new Thickness(0, 0, 0, 0);
			FrameLessPrinter.XPSShouldCreated = XPSShouldCreated;
			FrameLessPrinter.PDFShouldCreated = PDFShouldCreated;
			FrameLessPrinter.PageFrameProp.PageTitle = HeadLine;
			FrameLessPrinter.PageFrameProp.HeaderLeftIcon = RootPrintClass.WordUpLogo;
			FrameLessPrinter.PageFrameProp.HeaderRightIcon = RootPrintClass.JuziLogo;
			FrameLessPrinter.PageFrameProp.PageHeaderHeight = 35;
			FrameLessPrinter.PageFrameProp.PageFooterHeight = 20;

			FrameLessPrinter.PageFrameProp.FooterLeft = System.IO.Path.GetFileName(TargetFileName);
			FrameLessPrinter.PageFrameProp.FooterCenter = "Gedruckt: " + DateTime.Now.ToString("dd.MMM yyyy HH:mm")
				+ " © Bezirksvorstehung Liesing";

			//Window w = new Window();
			//w.Content = new ScrollViewer() { Content = this };
			//this.ItemsSource = CollectionOfClassesToPrint;
			//w.ShowDialog();

			FrameLessPrinter.Print(CollectionOfClassesToPrint, TargetFileName, Orientation);
			return TargetFileName;
			}
Esempio n. 2
0
        public override void PaintPrinter()
        {
            MessageBoxHelper.Show("请放入申请表正面进行打印! ");
            this.PrintExcelF6();
            if (Vehicle.DyHtzbh.Length > 0)
            {
                MessageBoxHelper.Show("请放入抵押表进行打印! ");
                this.PrintExcelF7();
            }
            MessageBoxHelper.Show("请放入申请表背面进行打印! ");
            BaseVehicleInfoPrinter printer       = new F5Printer(this.Vehicle);
            CommonPrinter          commonPrinter = new CommonPrinter(printer);
            //commonPrinter.ShowPreviewPrinter();
            GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();

            if (printSetting.PrintModel == "直接打")
            {
                commonPrinter.Print();
            }
            else if (printSetting.PrintModel == "选择打印机")
            {
                commonPrinter.ShowPreviewPrinter();
            }
            else
            {
                commonPrinter.Preview();
            }
            //todo,excelprinteer
        }
 private void PrintTask()
 {
     while (this.counter < this.stopCounter)
     {
         // StringBuilder msg = new StringBuilder();
         //int i = HotPrinterImporter.PrintLine(this.txtPrintContent.Text.Trim(), msg);
         //if (i == 0)
         //{
         TemplatePrintObject printer       = new TemplatePrintObject(config);
         CommonPrinter       commonPrinter = new CommonPrinter(printer);
         commonPrinter.SetPaperSize(config.PageWidth, config.PageHeight);
         commonPrinter.Print();
         counter++;
         //}
         this.setHint("正在打印:" + counter.ToString() + "页!");
         System.Threading.Thread.Sleep(this.threadSleepTime * 1000);
         if (this.counter == this.stopCounter)
         {
             this.setHint("打印完成:" + counter.ToString() + "页!");
             this.btnBeginPrint.Enabled = true;
             this.btnEndPrint.Enabled   = false;
             break;
         }
     }
 }
Esempio n. 4
0
        public void PrintView()
        {
            IPrinter printer = new TemplatePrintObject(config);

            CommonPrinter common = new CommonPrinter(printer);

            common.Preview();
        }
        private void btnPreview_Click(object sender, EventArgs e)
        {
            TemplatePrintObject printer       = new TemplatePrintObject(config);
            CommonPrinter       commonPrinter = new CommonPrinter(printer);

            commonPrinter.SetPaperSize(config.PageWidth, config.PageHeight);
            commonPrinter.Preview();
        }
Esempio n. 6
0
        public void PrintMargin(int left, int top, int right, int bottom)
        {
            IPrinter printer = new TemplatePrintObject(config);

            CommonPrinter common = new CommonPrinter(printer);

            common.SetPageSize(left, top, right, bottom);
            common.Print();
        }
Esempio n. 7
0
        public static void Print(IPrinter printer)
        {
            CommonPrinter commonPrinter = new CommonPrinter(printer);
            //commonPrinter.ShowPreviewPrinter();
            GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();

            if (printSetting.PrintModel == "直接打")
            {
                commonPrinter.Print();
            }
            else if (printSetting.PrintModel == "选择打印机")
            {
                commonPrinter.ShowPreviewPrinter();
            }
            else
            {
                commonPrinter.Preview();
            }
        }
Esempio n. 8
0
        private void btnPrintCode39_Click(object sender, EventArgs e)
        {
            string idcard = this.txtIdCard.Text.Trim();
            string name   = this.txtName.Text.Trim();

            if (idcard.Length == 0)
            {
                MessageBoxHelper.Show("请输入港澳通行证号码再按打印!");
            }
            else if (name.Length == 0)
            {
                MessageBoxHelper.Show("请输入姓名再按打印!");
            }
            else
            {
                HKMacoPrinter printer       = new HKMacoPrinter(idcard, name);
                CommonPrinter commonPrinter = new CommonPrinter(printer);
                //commonPrinter.Preview();
                commonPrinter.Print();
            }
        }
Esempio n. 9
0
        public static void PrintWindowsTemplate(object obj, string templateFile)
        {
            string path = Application.StartupPath + "\\Template\\" + templateFile;

            using (StreamReader fileStream = new StreamReader(path, Encoding.Default))
            {
                string        content = fileStream.ReadToEnd();
                string[]      rows    = content.Replace("\r\n", "?").Split("?".ToCharArray());
                List <string> lists   = new List <string>(rows.Length);
                for (int i = 0; i < rows.Length; i++)
                {
                    // if (rows[i].Length > 0)
                    lists.Add(ConvertPrintTemplate(obj, rows[i]));
                }


                ListStringPrintObject printer       = new ListStringPrintObject(lists, new System.Drawing.Font("宋体", 9), 10);
                CommonPrinter         commonPrinter = new CommonPrinter(printer);
                //commonPrinter.SetPaperSize(config.PageWidth, config.PageHeight);
                commonPrinter.Print();
            }
        }
Esempio n. 10
0
        /// <summary>
        /// This will create a single OpenXML document.  After it is created, it should be opened and a new Table of Contents before printing to PDF.
        /// </summary>
        internal static PrintResult BuildTtfBook(bool draft)
        {
            var styleSource = ModelMap.StyleSource;

            _filePath = ModelMap.FilePath + ModelMap.FolderSeparator + ".." + ModelMap.FolderSeparator + "TTF-Book.docx";
            try
            {
                InitWorkingDocument(styleSource);
                _document.MainDocumentPart.Document.AppendChild(new Body());
            }
            catch (Exception ex)
            {
                _log.Error("Artifact Output Folder: " + _outputFolder + " cannot be created.");
                _log.Error(ex);
                return(new PrintResult
                {
                    OpenXmlDocument = ""
                });
            }

            CommonPrinter.AddTaxonomyInfo(_document, ModelManager.Taxonomy.Version);

            _log.Info("Adding Bases");
            CommonPrinter.AddSectionPage(_document, "Base Tokens");
            foreach (var b in ModelManager.Taxonomy.BaseTokenTypes.Values)
            {
                BasePrinter.PrintTokenBase(_document, b, true);
            }
            Save();

            _log.Info("Adding Behaviors");
            CommonPrinter.AddSectionPage(_document, "Behaviors");
            foreach (var b in ModelManager.Taxonomy.Behaviors.Values)
            {
                BehaviorPrinter.PrintBehavior(_document, b, true);
            }
            Save();

            _log.Info("Adding Behavior-Groups");
            CommonPrinter.AddSectionPage(_document, "Behavior Groups");
            foreach (var b in ModelManager.Taxonomy.BehaviorGroups.Values)
            {
                BehaviorGroupPrinter.PrintBehaviorGroup(_document, b, true);
            }
            Save();

            _log.Info("Adding Property-Sets");
            CommonPrinter.AddSectionPage(_document, "Property Sets");
            foreach (var ps in ModelManager.Taxonomy.PropertySets.Values)
            {
                PropertySetPrinter.AddPropertySetProperties(_document, ps, true);
            }
            Save();

            _log.Info("Adding Template Formulas");
            CommonPrinter.AddSectionPage(_document, "Template Formulas");
            foreach (var tf in ModelManager.Taxonomy.TemplateFormulas.Values)
            {
                FormulaPrinter.PrintFormula(_document, tf, true);
            }
            Save();

            _log.Info("Adding Template Definitions");
            CommonPrinter.AddSectionPage(_document, "Template Definitions");
            foreach (var td in ModelManager.Taxonomy.TemplateDefinitions.Values)
            {
                DefinitionPrinter.PrintDefinition(_document, td, true);
            }
            Save();

            _log.Info("Adding Specifications");
            CommonPrinter.AddSectionPage(_document, "Token Specifications");
            foreach (var tf in ModelManager.Taxonomy.TemplateDefinitions.Keys)
            {
                var spec = Printer.TaxonomyClient.GetTokenSpecification(new TokenTemplateId
                {
                    DefinitionId = tf
                });
                if (spec == null)
                {
                    continue;
                }
                SpecificationPrinter.PrintSpecification(_document, spec);
            }
            Save();

            Utils.InsertCustomWatermark(_document, draft ? ModelMap.DraftWaterMark : ModelMap.WaterMark);
            Utils.AddFooter(_document, "Token Taxonomy Framework" + " - " + ModelManager.Taxonomy.Version.Version + ": " + ModelManager.Taxonomy.Version.StateHash);
            Save();
            return(GetPrintResult());
        }
Esempio n. 11
0
        public static void Print(StudentInfo student, Keys key)
        {
            BaseStudentPrinter printer = null;

            if (key == Keys.F1)
            {
                printer = new AllPrinter(student);
            }
            else if (key == Keys.F2)
            {
                printer = new F2Printer(student);
            }
            else if (key == Keys.F3)
            {
                printer = new F3Printer(student);
            }
            else if (key == Keys.F4)
            {
                printer = new F4Printer(student);
            }
            else if (key == Keys.F5)
            {
                printer = new F5Printer(student);
                //printer = new F5Printer(this.student);
            }
            else if (key == Keys.F6)
            {
                SetPrinted(student);
                printer = new ApplyPrinter(student);
            }
            else if (key == Keys.F7)
            {
                SetPrinted(student);
                printer = new ApplyExcelPrinter(student);
                ApplyExcelPrinter tmp = printer as ApplyExcelPrinter;
                tmp.PrintExcel(false);
                return;
            }
            else if (key == Keys.F8)
            {
                printer = new F8Printer(student);
            }
            else if (key == Keys.F9)
            {
                printer = new F9Printer(student);
            }
            if (printer != null)
            {
                CommonPrinter commonPrinter = new CommonPrinter(printer);
                //commonPrinter.ShowPreviewPrinter();
                GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();
                if (printSetting.PrintModel == "直接打")
                {
                    commonPrinter.Print();
                }
                else if (printSetting.PrintModel == "选择打印机")
                {
                    commonPrinter.ShowPreviewPrinter();
                }
                else
                {
                    commonPrinter.Preview();
                }
            }
        }
Esempio n. 12
0
		public String PrintPictureData (List<Object> CollectionOfClassesToPrint, String TargetFileName, String OrtsName)
			{
			CommonPrinter<PrintFileCards> LocationPicturePrinter = new CommonPrinter<PrintFileCards>();
			LocationPicturePrinter.XPSShouldCreated = XPSShouldCreated;
			LocationPicturePrinter.PDFShouldCreated = PDFShouldCreated;

			LocationPicturePrinter.PageFrameProp.PageTitle = "Orts Bilder für\r\n" + OrtsName;
			LocationPicturePrinter.PageFrameProp.HeaderLeftIcon = RootPrintClass.WordUpLogo;
			LocationPicturePrinter.PageFrameProp.HeaderRightIcon = RootPrintClass.JuziLogo;
			LocationPicturePrinter.PageFrameProp.PageHeaderHeight = 60;
			LocationPicturePrinter.PageFrameProp.PageFooterHeight = 20;

			LocationPicturePrinter.PageFrameProp.FooterLeft = System.IO.Path.GetFileName(TargetFileName);
			LocationPicturePrinter.PageFrameProp.FooterCenter = "Gedruckt: " + DateTime.Now.ToString("dd.MMM yyyy HH:mm")
				+ " © Bezirksvorstehung Liesing";

			LocationPicturePrinter.Print(CollectionOfClassesToPrint, TargetFileName);
			return TargetFileName + ";" + OrtsName;
			}
Esempio n. 13
0
		public String PrintSimpleFormattedArbeitsGruppenPersonenProjekte (List<Object> CollectionOfClassesToPrint,
			String TargetFileName, String HeadLine, String Orientation = "Portrait")
			{
			if (TargetFileName.Contains ('{'))
				throw new Exception ("TargetFileName = \"" + TargetFileName + "\"");
			
			CommonPrinter<PrintFileCards> FileCardPrinter = new CommonPrinter<PrintFileCards>();
			FileCardPrinter.XPSShouldCreated = XPSShouldCreated;
			FileCardPrinter.PDFShouldCreated = PDFShouldCreated;
			FileCardPrinter.PageFrameProp.PageTitle = HeadLine;
			FileCardPrinter.PageFrameProp.HeaderLeftIcon = RootPrintClass.WordUpLogo;
			FileCardPrinter.PageFrameProp.HeaderRightIcon = RootPrintClass.JuziLogo;
			FileCardPrinter.PageFrameProp.PageHeaderHeight = 60;
			FileCardPrinter.PageFrameProp.PageFooterHeight = 20;
			FileCardPrinter.NewPageCreated += (sender, items) =>
			{
				String Test = (sender as CommonPrinter<PrintFileCards>).PageFrameProp.PageTitle;
			};
			FileCardPrinter.PageFrameProp.FooterLeft = System.IO.Path.GetFileName(TargetFileName);
			FileCardPrinter.PageFrameProp.FooterCenter = "Gedruckt: " + DateTime.Now.ToString("dd.MMM yyyy HH:mm") + " © Bezirksvorstehung Liesing";

			//Window w = new Window();
			//w.Content = new ScrollViewer() { Content = this };
			//this.ItemsSource = CollectionOfClassesToPrint;
			//w.ShowDialog();

			FileCardPrinter.Print(CollectionOfClassesToPrint, TargetFileName, Orientation);
			return TargetFileName;
			}
Esempio n. 14
0
		public String PrintTermine (List<Object> CollectionOfClassesToPrint, String TargetDirectory)
			{
			CommonPrinter<PrintFileCards> FileCardPrinter = new CommonPrinter<PrintFileCards>();
			FileCardPrinter.XPSShouldCreated = XPSShouldCreated;
			FileCardPrinter.PDFShouldCreated = PDFShouldCreated;
			String TerminInfo = String.Empty;
			TerminPrint StartEntry = null;
			foreach (Object Entry in CollectionOfClassesToPrint)
				{
				if (Entry.GetType () == typeof (TerminPrint))
					{
					TerminInfo = (Entry as TerminPrint).NameID + " " + (Entry as TerminPrint).VonBis;
					StartEntry = Entry as TerminPrint;
					break;
					}
				}
			FileCardPrinter.PageFrameProp.PageTitle = StartEntry.TypBeschreibung + " Termin Information für\r\n" + TerminInfo;
			FileCardPrinter.PageFrameProp.HeaderLeftIcon = RootPrintClass.WordUpLogo;
			FileCardPrinter.PageFrameProp.HeaderRightIcon = RootPrintClass.JuziLogo;
			FileCardPrinter.PageFrameProp.PageHeaderHeight = 60;
			FileCardPrinter.PageFrameProp.PageFooterHeight = 20;
			FileCardPrinter.NewPageCreated += (sender, items) =>
			{
				String Test = (sender as CommonPrinter<PrintFileCards>).PageFrameProp.PageTitle;
			};

			FileCardPrinter.PageFrameProp.FooterLeft = System.IO.Path.GetFileName(StartEntry.DescriptionFileName);
			FileCardPrinter.PageFrameProp.FooterCenter = "Gedruckt: " + DateTime.Now.ToString("dd.MMM yyyy HH:mm") + " © Bezirksvorstehung Liesing";
			String TargetFileName = System.IO.Path.Combine (TargetDirectory, StartEntry.DescriptionFileName + ".xps");

			//Window w = new Window();
			//w.Content = new ScrollViewer () {Content = this};
			//this.ItemsSource = CollectionOfClassesToPrint;
			//w.ShowDialog();

			FileCardPrinter.Print(CollectionOfClassesToPrint, TargetFileName);
			return TargetFileName + ";" + StartEntry.DescriptionElements;
			}
Esempio n. 15
0
		/*
				public void PrintFileCard (DataSet DataSetToPrint, FileCardPrintFormat Format, String SubDir = null)
							{

							String Extension = ".xps";
							String FinalTargetDirectory = DataWrapper.Instance.TargetDirectory;
							if (!String.IsNullOrEmpty(SubDir))
								{
								FinalTargetDirectory = System.IO.Path.Combine(DataWrapper.Instance.TargetDirectory, SubDir);
								}
							if (!Directory.Exists(FinalTargetDirectory))
								Directory.CreateDirectory(FinalTargetDirectory);

							switch (Format)
								{
								case FileCardPrintFormat.PupilPrimarySelection:
									PrintPupilPrimarySelection (DataSetToPrint, System.IO.Path.Combine
										(FinalTargetDirectory, "WunschKartenZurErstselektion" + Extension));
									break;
								case FileCardPrintFormat.PupilSecondarySelection:
									break;
								}
							}



						private void PrintPupilPrimarySelection (DataSet DataSetToPrint, String TargetFileName)
							{



							List<Object> CollectionOfClassesToPrint = new List<object> ();

							foreach (DataRow ProjektRow in DataSetToPrint.Tables ["Projekte"].Rows)
								{
								String ProjektID = ProjektRow ["ID"].ToString ();
								DataSet AllForThisProjekt = WordUp23.DataWrapper.Instance.GetAllDataBelongingToOneProject (ProjektID, true, true, true, true);

								CollectionOfClassesToPrint.Add(new PlanungPrint(AllForThisProjekt.Tables["ProjektUebersicht"].Rows [0]));

								foreach (DataRow AktivitaetenRow in AllForThisProjekt.Tables["FullAktivitaeten"].Rows)
									{
									CollectionOfClassesToPrint.Add (new AktivitaetenPrint (AktivitaetenRow));
									}

								foreach (DataRow PlakatRow in AllForThisProjekt.Tables ["WSPlakate"].Rows)
									{
									CollectionOfClassesToPrint.Add (new IdeePrint (PlakatRow));
									}
								}




				//Window w = new Window();
				//this.ItemsSource = CollectionOfClassesToPrint;
				//w.Content = this;
				//w.ShowDialog();

				CommonPrinter<PrintFileCards> FileCardPrinter = new CommonPrinter<PrintFileCards>();
					FileCardPrinter.XPSShouldCreated = XPSShouldCreated;
					FileCardPrinter.PDFShouldCreated = PDFShouldCreated;
					FileCardPrinter.PageFrameProp.PageTitle = "Planungs Daten zur näheren Definition fehlender Informationen";
					FileCardPrinter.PageFrameProp.HeaderLeftIcon = RootPrintClass.WordUpLogo;
					FileCardPrinter.PageFrameProp.HeaderRightIcon = RootPrintClass.JuziLogo;
					FileCardPrinter.PageFrameProp.PageHeaderHeight = 60;
					FileCardPrinter.PageFrameProp.PageFooterHeight = 20;

					FileCardPrinter.PageFrameProp.FooterLeft = System.IO.Path.GetFileName (TargetFileName);
					FileCardPrinter.PageFrameProp.FooterCenter = "Gedruckt: " + DateTime.Now.ToString ("dd.MMM yyyy HH:mm") + " © Bezirksvorstehung Liesing";
					FileCardPrinter.Print(CollectionOfClassesToPrint, TargetFileName);
					}
		*/

		public String PrintStatistiken(List<Object> CollectionOfClassesToPrint, String TargetFileName,
			String PageHeadLine)
			{
			CommonPrinter<PrintFileCards> FileCardPrinter = new CommonPrinter<PrintFileCards>();
			FileCardPrinter.XPSShouldCreated = XPSShouldCreated;
			FileCardPrinter.PDFShouldCreated = PDFShouldCreated;
			FileCardPrinter.PageFrameProp.PageTitle = PageHeadLine;
			FileCardPrinter.PageFrameProp.HeaderLeftIcon = RootPrintClass.WordUpLogo;
			FileCardPrinter.PageFrameProp.HeaderRightIcon = RootPrintClass.JuziLogo;
			FileCardPrinter.PageFrameProp.PageHeaderHeight = 60;
			FileCardPrinter.PageFrameProp.PageFooterHeight = 20;
			FileCardPrinter.NewPageCreated += (sender, items) =>
			{
				String Test = (sender as CommonPrinter<PrintFileCards>).PageFrameProp.PageTitle;
			};

			FileCardPrinter.PageFrameProp.FooterLeft = System.IO.Path.GetFileNameWithoutExtension(TargetFileName);
			FileCardPrinter.PageFrameProp.FooterCenter = "Gedruckt: " + DateTime.Now.ToString("dd.MMM yyyy HH:mm") + " © Bezirksvorstehung Liesing";

			//Window w = new Window();
			//w.Content = new ScrollViewer () {Content = this};
			//this.ItemsSource = CollectionOfClassesToPrint;
			//w.ShowDialog();

			FileCardPrinter.Print(CollectionOfClassesToPrint, TargetFileName);
			return TargetFileName + ";" + " ";
			}