Barcode font not being embedded in PDF output

13 views
Skip to first unread message

Andy R

unread,
Jun 19, 2026, 8:29:09 PM (5 days ago) Jun 19
to Migrated By Firefly
I'm using Firefly version 32398, which is pretty old.  Has there been an update to the PrinterWriterWithPdf code that might help me?  

I am outputting a barcode using the IDAutomation Code 128 TrueType barcode font.  This requires me to call a function provided by IDAutomation to encode the data.  Then I can put that encoded data on my output form and set the font to the Code 128 font.  Printing the output directly or displaying on screen shows the barcode correctly, but when I output to PDF, the encoded data is displayed in a regular text font.  I have EmbedFonts=Y set.

I am able to embed the font in a PDF when I put the encoded text in Word, set the font, and save to PDF.  So I know the font works correctly.

Any help would be greatly appreciated.

Steve Burrows

unread,
Jun 20, 2026, 6:03:10 AM (5 days ago) Jun 20
to Andy R, Migrated By Firefly
We are on 34902 or a little later, and while I dont have the wherewithal to test it, I did happen to spot the bit that in theory does the embedding. It LOOKS like what the AI OverLord suggests should be correct. Might be worth a breakpoint and see if the catch is being triggered instead for some reason (or indeed if the function is triggered at all).

In PrinterWriterWithPdf.cs line 716 (your version may differ)
                        Func<iTextSharp.text.Font> getFont = () =>
                        {
                            try
                            {
                                return FontFactory.GetFont(fontName, (!PrinterWriter.UseEmbeddedFontsInPdf || IsAnsiFont(fontName)) ? ENV.LocalizationInfo.Current.OuterEncoding.WebName : BaseFont.IDENTITY_H, PrinterWriter.UseEmbeddedFontsInPdf, 12, fontBoldItalicStyle);
                            }
                            catch (DocumentException)
                            {
                                return FontFactory.GetFont(fontName, BaseFont.WINANSI, false, 12, fontBoldItalicStyle);
                            }
                        };

I am a total noob understanding ENV and the subsystem, it just so happens I was in the area. I have been fighting Printing the last couple of days trying to get Left Margin to be applied. Blew 2 weeks worth of credits in a day, GPT has a terrible time with the printing implementation and got me nowhere.

--
You received this message because you are subscribed to the Google Groups "Migrated By Firefly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to migrated-by-fir...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/migrated-by-firefly/b8671077-a9e2-4831-9cdc-86b1c29b3f8en%40googlegroups.com.

Noam Honig

unread,
Jun 21, 2026, 4:51:08 AM (4 days ago) Jun 21
to Andy R, Migrated By Firefly
breakpoint in the getFont catch is not a bad idea...

The fonts are read from various folders in "static iTextSharpPrintJob()" so maybe making sure the font file is in one of these folders.



Noam Honig  
Founder & CEO

--

Andy R

unread,
Jun 22, 2026, 3:42:43 PM (2 days ago) Jun 22
to Migrated By Firefly
Found the problem.  My font was installed under my account instead of for all users.  The Firefly code found it for display and printing, but iTextSharp was only looking in the c:\Windows\Fonts folder, not under my account's appdata.  I reinstalled the font for all users and it works.

Thank you Steven and Noam!

Reply all
Reply to author
Forward
0 new messages