Sunday, July 9, 2023

SSRS - How to print a same report for Laser jet printer as well as Dot Matrix Printer

A dot matrix printer is a type of printer that uses a print head that moves back and forth, striking an ink-soaked ribbon against the paper to produce text and graphics. The Dot matrix printer is used to print only the text and characters of pseudographics. Accordingly, the viewer displays only the text and borders of objects as pseudographics characters. This is used to print very large size reports with only pseudographics. 

Laser printer is used for very good quality printing especially for application form, detailed reports , A4 sizing report.

Let's have a simple SSRS report.

If we want to print same SSRS report in different fonts based on the printer's type then we need to use font from the SSRS expression. We can have a input parameter for printer type and based on the value of printer type input parameter, Report will show data in specific font.
1) For Dot Matrix printer - Font can be "Courier New"
2) For Laser jet printer - Font can be "Aerial"

To do this, we need to change the textbox property. Right click on any textbox in the report==>TextBox Properties==> Font==>Right the expression like below for our report

=IIF(Parameters!PrinterType.Value= "Dot Matrix","Courier New","Arial")

You need to change it for all the required text boxes.
Now run the report, give the parameter value and see the result.

Report Print with LaserJet Printer:

Report Print with Dot Matrix Printer: You can see report in "Courier New" font.

No comments:

Post a Comment