Add Text object with printer font
How can I generate a Text object with a font that is only available for a particular printer?
Background:
We use a program ActiveFax for faxing documents. That program created a printer, ActiveFax. All documents that are printed to that printer will be faxed. The program looks into the document for a text with a font "ActiveFax" and take the value of that text object to determine the faxnumber.
I tried to set the printer to ActiveFax before I created the text object but when I debug I see that the font is not "ActiveFax"but "Ms Sans Serif".
This is the code I used:
Background:
We use a program ActiveFax for faxing documents. That program created a printer, ActiveFax. All documents that are printed to that printer will be faxed. The program looks into the document for a text with a font "ActiveFax" and take the value of that text object to determine the faxnumber.
I tried to set the printer to ActiveFax before I created the text object but when I debug I see that the font is not "ActiveFax"but "Ms Sans Serif".
This is the code I used:
                                report1.PrintSettings.Printer = "ActiveFax"; //Set printer to ActiveFax, before adding Text object
                                report1.PrintSettings.ShowDialog = false;
                                report1.Prepare(false);
                                #region Add activefax string
                                TextObject text1 = new TextObject();
                                ReportPage page1 = report1.FindObject("Page1") as ReportPage;
                                text1.Name = "Activefaxinfo";
                                text1.Left = 0;
                                text1.Height = Units.Centimeters * 1;
                                text1.Width = Units.Centimeters * 10;
                                text1.Text = "@F2110388505050@";
                                text1.HorzAlign = HorzAlign.Center;
                                ]text1.Font = new Font("ActiveFax", 10, FontStyle.Regular); //Here I set the font
                                page1.ReportTitle.Objects.Add(text1);
                                #endregion activefax string
                                report1.Prepare(false);
                                report1.PrintPrepared();
Comments
This font must be installed in your system. You can't create .Net Font instance with non-installed fonts.