Chance
Your problem is based in the way the barcode reader is interpreting the string you are presenting to it
the string being formatted needs to incorporate the all the right stop and start codes and Check codes as well as the characters that are the intended output ( and each barcode format is different ) You can't just format the string alone.
please review the following https://en.wikipedia.org/wiki/PDF417
make sure you understand how the string needs to be generated so that the barcode reads it in the intended manner.