0

I'm trying send ActiveReports formatted reports to my company's RightFax server, and pre-set some of the fax fields, like FAX number, sender, and recipient. The RightFax documentation says that the document must include Embedded Codes to set these values, e.g. <TOFAXNUM:12345556789><TONAME:Recipient><FROMNAME:Sender>. I create a TextBox or Label in ActiveReports that contains this text. But the values are not set when RightFax receives the document and brings up the RightFax client UI. The Embedded Codes remain in the fax image. I have the RightFax printer driver set to HP LaserJet 4. I'm developing in C#, using Visual Studio 2010 Professional.

One suggestion on the web is to make sure the Embedded Codes are set in Courier or another "printer font". However, Visual Studio does not have "Courier" or "Times Roman", only MS true type versions of these standard fonts, "Courier New" and "Times New Roman".

This method of sending faxes is working with older software, that doesn't use ActiveReports, on another machine using the same RightFax server.

Any experience you can share interfacing ActiveReports to RightFax would be most appreciated.

Thanks,

Gregg Lobdell

gmlobdell
  • 383
  • 3
  • 10
  • In the end I completely avoided the embedded codes. I exported the active report to a tiff file, then used that file as the fax body. I created a window that collected the settings for the fax, then called the RightFax API to create, configure, and send the fax. – gmlobdell Jun 14 '13 at 20:03

2 Answers2

0

You could accomplish your task by controlling the whole printing process and sending the escape sequence using Windows API. I assume you using ActiveReports 6 or section-based reports of ActiveReports 7.

In more detail:

  • create your own PrintDocument and define PrintPage handler
  • in the PrintPage handler send escape sequence to printer using Escape winapi call (see the example on CodeProject)
  • render the page itself by calling the Page.Draw()
olegz
  • 1,189
  • 10
  • 20
  • Nice copy of the same answer to this question that I asked in the ActiveReports forum. I'm looking for a wider experience base here on StackOverflow, maybe someone with RightFax experience. @olegz Do you have anything to add? – gmlobdell Jan 15 '13 at 21:15
  • It's completely mine answer, someone just copied it to forum. Do you have any particular troubles on the way I suggested? – olegz Jan 17 '13 at 05:48
  • gmlobdell, I have posted a project that uses the code from codeproject. Can you please download it from here and run it please. http://www.datadynamics.com/forums/150920/ShowPost.aspx – Rajnish Sinha Jan 17 '13 at 19:38
  • @olegz Sorry about the copy issue, I read the timestamps wrong. Your answer here was first and the other on the ActiveReports forum was the copy. I've accepted your answer here, since it's the closest to what I actually ended up implementing. I didn't use the Escape winapi or Page.Draw(), instead I ended up calling the RightFax API to set the FAX parameters I needed to set. I completely avoided the embedded codes. – gmlobdell Jun 14 '13 at 19:57
0

As long as you use a true type font, the printer should recognize that font and be able to "read" the text in it. Only old bitmap fonts are fonts that might be not readable by the printer. Usually commonly used TT fonts on windows like "Courier New" or "Times New Roman", are already in the printer so they won't even be downloaded.

However, RightFax does have some documentation on escape codes here, so you might want to try using escape codes with ActiveReports. Also, here is an example of using the SystemPrinter object in ActiveReports6 to send escape codes directly to the printer without using any special API. You might try using that code and replacing the escape code there with ones that RightFax understands.

Finally, ActiveReports essentially prints by getting a graphics from the printer and drawing on it. Textboxes are real text drawn with appropriate text commands (i.e. text is not rendered as bitmaps). This is a normal way of printing in modern windows so any printer should see the text as normal text. You should be abel to see the same exact results by writing your own simple printing code in .NET and sending it to the RightFax driver. If it works there it will work in ActiveReports.

If it isn't working, and the escape code trick above won't work, I think contacting RightFax and asking them for insight into how to print to their driver from a .NET application would be the next logical step.

Hope this helps!

Scott Willeke
  • 8,884
  • 1
  • 40
  • 52