473,509 Members | 2,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

printint problem

I'm trying to print out barcodes within my program using Code128B
fonts
The code is something as follows:

strDocID = CalculateCheckSum(strDocID);
CRect rectBarcode = PrintText(pDC, rectFolder.bottom+m_nTextSpacing *
10, rect, strDocID, ALIGN_CENTER);
CString PrintContainerLabel::CalculateCheckSum(CString barcode)
{
int checkSum;
CString Code128b;

char letter;
int val = 104;
checkSum = val;

for (int i = 0; i < barcode.GetLength(); i++)
{
letter = barcode.GetAt(i);
val = letter;
val -= 32;
checkSum += val * (i + 1);
}

int moduloValue = checkSum % 103;
moduloValue += 32;

Code128b = char(202);
Code128b += barcode;
Code128b += char(moduloValue);
Code128b += char(138);

return Code128b;
}
something that I absolutely can not figure out is that it doesnt work
for "1593387" - prints out a weird character at the end of my barcode.
For any substring of this or if I add any more values, miraculously
starts working.
If anybody has any suggestions, I would greatly appreciate!
Anton

Oct 4 '07 #1
2 1471
gr********@gmail.com wrote:
I'm trying to print out barcodes within my program using Code128B
fonts
The code is something as follows:

strDocID = CalculateCheckSum(strDocID);
CRect rectBarcode = PrintText(pDC, rectFolder.bottom+m_nTextSpacing *
10, rect, strDocID, ALIGN_CENTER);
This looks like windows specific code which makes it OT here, you would
get better responses on a windows programming group.

--
Ian Collins.
Oct 4 '07 #2
<gr********@gmail.comwrote in message
news:11**********************@19g2000hsx.googlegro ups.com...
I'm trying to print out barcodes within my program using Code128B
fonts
The code is something as follows:

strDocID = CalculateCheckSum(strDocID);
CRect rectBarcode = PrintText(pDC, rectFolder.bottom+m_nTextSpacing *
10, rect, strDocID, ALIGN_CENTER);
CString PrintContainerLabel::CalculateCheckSum(CString barcode)
{
int checkSum;
CString Code128b;

char letter;
int val = 104;
checkSum = val;

for (int i = 0; i < barcode.GetLength(); i++)
{
letter = barcode.GetAt(i);
val = letter;
val -= 32;
checkSum += val * (i + 1);
}

int moduloValue = checkSum % 103;
moduloValue += 32;

Code128b = char(202);
Code128b += barcode;
Code128b += char(moduloValue);
Code128b += char(138);

return Code128b;
}
something that I absolutely can not figure out is that it doesnt work
for "1593387" - prints out a weird character at the end of my barcode.
For any substring of this or if I add any more values, miraculously
starts working.
If anybody has any suggestions, I would greatly appreciate!
Anton
Most likely your checksum calculation is wrong and for 1593387 it produces a
value outside of the barcode char set. Try taking a look at moduloValue for
ones printed correctly and ones with this "weird character".
Oct 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3046
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
3733
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
2009
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
9
2217
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
117
7102
by: Peter Olcott | last post by:
www.halting-problem.com
28
5170
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
3785
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
4870
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
4534
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
3
3369
by: ypytt | last post by:
Hi all, I'm developing a Windows application in C#. It generates reports using ReportViewer. These reports should be printed on a dot matrix printer. However, there is a problem. The application...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7073
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1571
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.