Hello, I have a problem with a specific private font when I generate pdf, the 5 MT GBS Code 2 font does not work, this font shows code bars.
I’ve made a simple project to debug this problem, but I can’t get it to work with all the suggestions posted.
the FontSettings.Fonts IList class shows the font installed in the project, but it doesn’t work internally when saving PDF, the text doesn’t show the bar code. Does not generate any exception
This is the code I am using:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using GemBox.Document;
namespace PruebaPDFCodebar
{
class Program
{
static void Main(string[] args)
{
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
FontSettings.FontsBaseResourceLocation = "/Resources/";
IList<FontFile> P = FontSettings.Fonts;
int chk = 0;
foreach (FontFile font in P)
{
if (font.FamilyName == "GBS Code 2 of 5 MT")
{
chk = 1;
}
}
if (chk == 1)
{
DocumentModel aDoc;
aDoc = new DocumentModel();
aDoc.Sections.Add(new Section(aDoc, new Paragraph(aDoc, new Run(aDoc, "’’“Éé˜")
{
CharacterFormat = { FontName = "GBS Code 2 of 5 MT" }
},
new SpecialCharacter(aDoc, SpecialCharacterType.LineBreak))));
aDoc.Save("C:\\PRUEBACODEBAR\\PRUEBACODEBAR.DOCX");
aDoc = DocumentModel.Load("C:\\PRUEBACODEBAR\\PRUEBACODEBAR.DOCX");
aDoc.Save("C:\\PRUEBACODEBAR\\PRUEBACODEBAR.PDF");
}
else
{
MessageBox.Show("ERROR EN FUENTE GBS CODE 2 OF 5 MT");
}
}
}
}
image with font resource configured like “Resource”
when I see the .docx document with local installed font shows it well
when I see the pdf document gembox dont used the correct font.
I need support to fix it.