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:
                                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

  • edited 2:00AM
    Hello,

    This font must be installed in your system. You can't create .Net Font instance with non-installed fonts.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.