Experience with Crystal Reports printing on Dot Matrix Printer

Since few months, I was working on a project which involved migrating Cobol based ERP application to .NET. It includes writing object oriented code, creating RDBMS database and import data from old files (flat files actually) to this database. And finally generate reports and bills (in huge amount, hundreds of pages at a time)

I have been using Crystal Reports (CR) since a long time, so I decided to go for it. CR is the best tool for designing reports. Its easy and support many export formats. The most exciting thing is – it comes bundled with Visual Studio for evaluation purpose. Hence, I could evaluate it before purchasing.

So, I designed the reports and tested it on regular laser/ink jet printers – it was perfect. The formatting, printing speed and page-breaks was as expected.

In India (as per my knowledge and requirements of this application), even though we talk about e-Governance and paperless office, to submit reports to government (or to be specific RG32 report) it must be in triplicates (on different colour paper). So, laser/inkjet printers was no option and It was a costly solution. Hence, we had to depend on dot matrix printer. But, problems like – the speed of printing which was very slow, formatting which was very dark and incorrect page-breaks on continuous paper were introduced when I printed the same reports on dot matrix printer. The problem is mentioned here and here on MSDN

So, I checked many options (as listed below) from various sources (SAP Forum, MSDN Forum, other software products in same category, etc).

  • I tried exporting report to given formats (Word, Excel, PDF) but the same problem of printing speed, incorrect formatting and incorrect page-breaks remained as it is – unsolved.
  • Some software products used to export the report data to DOS and print from there. This wasn’t feasible for me and didn’t want to do this. Because, actually I was migrating DOS based application to Windows.
  • Install correct printer drivers was one solution. So, I tried latest drivers from manufacturer as well as drivers which comes bundled within Windows. But, it wasn’t the solution. The problem was still there.
  • On some forums (link here), I found out that we need to install Generic/Text printer driver. This will give option to use Draft font with Character Per Inch (CPI) size required for dot matrix printers. The report in viewer showed correctly, but on printer – the same problem.

At last, I found one solution (listed here) which exports the report to text format and print it directly. But then the code was showing error on line

ExportOptions.CreateTextFormatOptions.CharactersPerInch = 16

After searching a lot, I found (actually a reply to my question on SAP Forum) that, the version of CR which comes with VS2008 is BASIC. It doesn’t have export to text functionality (!). I’ll need to upgrade to CR2008 Full. Hence I upgraded to the full version and tested the code mentioned at this link 

And Bingo! I was able to export the raw data to text file and print it directly. And everything (font, formatting, page breaks, speed) was as expected.

There were many other issues which came into picture when I upgraded to full version of CR, like it doesn’t integrate well with VS2008. I needed SP0 of CR2008 to do this integration, then deployment of CR2008 runtime on client machines. But these issues were not of much headache and importance. These all issues are now got resolved and now my project is in testing and final data migration phase.

It is also scheduled for next version with additions of new functionalities.

When people are happy, I’m happy Smile

I hope, this will help developers, who are interested in building applications which involves reporting and printing these reports on dot matrix printers.

Namaste

Mayur Tendulkar | www.mayurtendulkar.com

Published by

Mayur Tendulkar

Struggling Juggler

8 thoughts on “Experience with Crystal Reports printing on Dot Matrix Printer”

  1. Dear Mayur
    I am working with ASP.Net application and getting the issue with text formatting, after exporting report to text format.
    Text file is not in proper format…I tried a lot but no luck.
    If you also faced the same issue then can you please share…..
    If you will copy and paste the below text to a text file then you'll get the exact issue am facing……
    01020000531 Latha 8,000.00 1 290.00 0.00

    01020000532 Amaravathi 8,000.00 1 290.00 0.00

    Like

  2. Mayur,
    this is a common experience when migrating or facing with some of these legacy applications. Although we tend to be pre-occupied with printing to PDF as much of our proposition is based on the paperless office:)

    Like

  3. Hello Tendulkar,
    I m using CRXI Prof Full SP4, and VS2008, I have same problem “.CreateTextFormatOptions” option is not coming.
    Pls provide me how to integrate CR with VS.
    And what is solution of this problem.
    Thanx in advance.

    Like

  4. Dear Mayur,

    I am also facing the same problem with my one Financial Application.Currently I am using VS2005 and Crystal Report2005.

    Export to text method is not available in this version.,

    What Crystal Report version should I need to export the CR file to text file ??. Please advice me ..

    or Else how can I send the report to DOS mode printing for faster dotmatrix printing.

    Any help would be greatly appreciate..

    Thanks & Regards,
    martin.

    Like

  5. Hi Martin,
    Yes, this is a common problem and I think, this can be a business strategy of the owner.
    The version, which comes with VS is basic/evaluation version and I found some features missing. Which includes dot matrix printing (or I should say direct raw text printing).
    Try installing latest and full version of Crystal Reports. And I think, you can try before buying.
    The code, which I wrote, works perfectly for me, when I installed full version.
    I hope, it answers your question.
    Regards,
    Mayur Tendulkar

    Like

  6. Dear Mayer ,
    Thanks for your reply .

    What crystalreport version should i intall for VS2005 to get the export to text method . Please help me on this .

    Regards,
    Martin.

    Like

  7. Hi Mayur ,

    Sorry once again I need your help .

    I have done the functionality . everything is working fine . yet Can you plz post the code which is Exporting the CR document to TEXTFILE and Print Directly the printer…

    Its exporting to a tempfile and printer is not talking the exported file …how to direct the printer to print the exported file ..

    Please its very urgent .

    Thanks & Regards,
    Martin.

    Like

  8. I know this might be a long delay from this post but I need help.
    My file generated as shown in the post and its corresponding links but the file creates page break.
    Also changing in value of `CrystalDecisions.Shared.ExportOptions.CreateTextFormatOptions.CharactersPerInch = 16` and `CrystalDecisions.Shared.ExportOptions.CreateTextFormatOptions.LinesPerPage = 50`
    won’t help.
    All with value changed shows the same result every time.
    I hope I may get some help.

    Like

Leave a reply to Martin Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.