Including Code 39 Bar Codes in SynPDF documents
I need to print a code 39 format bar code in a PDF document.
I can create a Print API document using free3of9.ttf font, and fre3of9x.ttf
I have also tried Code39r.ttf in my PDF document.
I am printing the invoice number as *123456* which works with the Print API but not with synPDF
All of them create a corrupt PDF file which cannot be opened.
Has anyone any ideas as to how I can include a code 39 bar code in a PDF document, using synPDF ?

I tried removing the *s around the field so that it would print as normal text and not as a bar code, but the PDF was still corrupted when I tried this
I was able to create a print API document with a bar code using the same free fonts, and then print this to PDFCreator and to Microsoft Print to PDF, and both created the PDF fine with the bar code, so the bar code itself does not corrupt the PDF
I think the problem is the combination of the free fonts I tried and the synPDF PDF creator.
Has anyone any suggestions for a different Code39 bar code font
Here is the code I am using to craete the PDF :
if (!mBarCodeFont)
mBarCodeFont = mPDF.LoadTrueTypeFont("fonts:Code39r.ttf")
mPDF.SelectFont(mBarCodeFont,fontSize)
mPDF.DrawTextRC('*' + atrim(text) + '*',row ,column)
text contains "17110024"
I have tried this as a string and as an A field
I seem to recall PDF's have a wild of a time with embedded fonts anyway (not all readers support them).
I'd get 2 identical PDF's produced using the two different methods and then attempt to compare the two.
Using the attached PDF's I ran the one with the long file name though an online PDF Validator (https://www.pdf-online.com/osa/validate.aspx) and it failed validation:
File gordon_04-JAN-2018_103310.pdf Compliance pdf1.3 Result Document does not conform to PDF/A. Details Validating file "gordon_04-JAN-2018_103310.pdf" for conformance level pdf1.3 The value of the key Encoding is StandardEncoding but must be WinAnsiEncoding or MacRomanEncoding or MacExpertEncoding. The key CapHeight is required but missing. The "endobj" keyword is missing. The key Subtype is required but missing. The value of the key Type is Outline but must be Outlines. The document does not conform to the requested standard. The document doesn't conform to the PDF reference (missing required entries, wrong value types, etc.). The document does not conform to the PDF 1.3 standard. Done.
Unfortunately that validator didn't tell me where that "endobj" was missing (there are several objects in that document, open it in notepad and see).
It looks like under the hood this (synPDF) is using Haru Free PDF Library and it looks like it was generated using the latest lib available.
The Microsoft produced PDF of course works and validates clean :|
I suspect at the end of the day you'll probably find a bug in libHaru, luckily its open source: https://github.com/libharu/libharu (hasn't been modified in years) but on the other hand not sure how much work you wanna do digging into the PDF standard...

For what its worth, I searched online for bar code fonts and found one at http://www.fonts4free.net/3-of-9-barcode-font.html. When I tested it with SynPDF, it seemed to work just fine. It's a bit unclear whether the font is free for commercial use, though. I expect there are plenty of commercial fonts that would work as well.

NOTE - Haru can use only TrueType fonts which have Unicode cmap and the following tables. "OS/2", "cmap", "cvt ", "fpgm", "glyf", "head", "hhea", "hmtx", "loca", "maxp", "name", "post", "prep".
My guess is that your font doesn't meet the above criteria.

Thanks Tate for finding a free font which works.
I had tried but wasn;t lucky enough to find one, and most of my seraches took me back to the original font.
its working fine now