0

I am in need of some help adding a MICR line to a printed output file.

I have the numbers (transit, account, and trans code) needed for the MICR line. What I need is to show the IDAutomation transit number characters (|:) that surround the transit number and the ON-US symbol (||') after the account number.

I create the MICR line to be written when I parse the original data file used to create the statement page. This MICR line is stored as a string that is then output in the necessary location on the output sheet.

The original program was written in roughly 2005, outputting PCL format documents. I need to make this work until I can get it rewritten into C# outputting PDF using JDF for tray pulls.

Create the MICR string

string stmtTransCode = FindTransCode(vStrPage);
stmt->SetStmtTransCode(stmtTransCode);

dynamic_cast<MBStatement*>(stmt)->m_strMICR = "";
if (stmtTransCode != "")
{ 
    // leading MICR Transit symbol ('A')
    dynamic_cast<MBStatement*>(stmt)->m_strMICR += "072413845";
    // trailing MICR transit symbol ('A')
    dynamic_cast<MBStatement*>(stmt)->m_strMICR += " " + stmt->GetAccNum();
    // trailing MICR accy number symbol ('C')
    dynamic_cast<MBStatement*>(stmt)->m_strMICR += "      " + stmt->GetStmtTransCode();
}

Print the MICR string from a Writer class

BOOL MBStmtWriter::WriteMICRLine(string m_MICRLine) {

// print MICR/OCR line 
m_printer.WriteCMD(m_printer.getFont("OCRAFont") + m_printer.getXYPosCMD(2000, 3225));
m_printer.WriteCMD(m_MICRLine);

return 0;
}
lsieting
  • 85
  • 2
  • 13
  • This line `m_printer.getFont(/*...*/)` looks suspicious. What is the declaration of `WriteCMD`? Also, what is the return type of `getXYPosCMD`? Are you trying to print the name of the font? You may want to use `std::ostringstream` to convert integers to text. – Thomas Matthews Jan 22 '18 at 15:33
  • Are you outputting in HP PCL language (if so, which version)? Or which **P**age **C**ontrol **L**anguage are you using? – Thomas Matthews Jan 22 '18 at 15:35
  • I recommend writing your complete MICR text to a string, then outputting to the stream / printer. – Thomas Matthews Jan 22 '18 at 15:36
  • Does your MICR printer require a special command to use MICR ink? – Thomas Matthews Jan 22 '18 at 15:37
  • @ThomasMatthews - The m_printer.getFont() is loading a defined font set by reference and applying it as a macro to the document for the next printed line of text. HP PCL 5. I am building a text string for the MICR then printing that string. We are not using MICR ink. But we are required to use the MICR font as the OCR font on the document. – lsieting Jan 22 '18 at 15:43
  • @ThomasMatthews - WriteCMD() looks to be a custom public void function(string cmd){(*m_fout).write(cmd.data(), cmd.length()); if(!m_fout->good()){ throw error message } } – lsieting Jan 22 '18 at 15:53
  • My question is whether `WriteCMD` is used to print text, write a data buffer, or select a font. According to your comment, it writes data to the printer. So does `m_printer.getFont()` return the correct data to write to the printer. Your `+` operator is suspicious. You may want to create a temporary string variable, then write the temporary to the printer. At least you'll be able to see what is sent to the printer a lot easier. – Thomas Matthews Jan 22 '18 at 18:08
  • @ThomasMatthews - the WriteCMD() writes text using macros that are loaded for the font at the location X,Y sent to the getXYPosCMD. Then it writes the necessary text as needed until the next getFont() using the last font loaded. As an aside, I found out that the OCR_A font set does not include the symbols I needed. I needed a MICR font set (shich I have acquired) and the program is working as intended now. Thanks. – lsieting Jan 25 '18 at 17:57

0 Answers0