Wrong font after converting docx to Pdf

I’m trying to use a text in a specific barcode font, but when saving to pdf (or Jpeg) I’m seeing random symbols (font: ms reference specialty according to PDF XChange viewer)

I’m using the latest version of Aspose (19.10) on AsposeWords.zip (715.6 KB)
the attached files in combination with this code:

Document doc = new Document("barcode.docx");
var builder = new DocumentBuilder(doc);

var pdfSaveOptions = new PdfSaveOptions
{
	EmbedFullFonts = true,
	FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll
};

doc.Save($@"c:\temp\qrcode_{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.pdf", pdfSaveOptions);

How can I embed this specific font in the PDF version?

@kevin.parret

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19385. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@kevin.parret

As a workaround of this issue, please use the following code example. Hope this helps you.

Document doc = new Document(MyDir + @"barcode.docx");

var pdfSaveOptions = new PdfSaveOptions
{
    EmbedFullFonts = true,
    FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll
};

// Retrieve the array of environment-dependent font sources that are searched by default. For example this will contain a "Windows\Fonts\" source on a Windows machines.
// We add this array to a new ArrayList to make adding or removing font entries much easier.
ArrayList fontSources = new ArrayList(FontSettings.DefaultInstance.GetFontsSources());

// Add a new folder source which will instruct Aspose.Words to search the following folder for fonts. 
FolderFontSource folderFontSource = new FolderFontSource(@"C:\MyFonts\", true);

// Add the custom folder which contains our fonts to the list of existing font sources.
fontSources.Add(folderFontSource);

// Convert the ArrayList of source back into a primitive array of FontSource objects.
FontSourceBase[] updatedFontSources = (FontSourceBase[])fontSources.ToArray(typeof(FontSourceBase));

// Apply the new set of font sources to use.
FontSettings.DefaultInstance.SetFontsSources(updatedFontSources);

doc.Save(MyDir + @"19.10-using FolderFontSource.pdf", pdfSaveOptions);

Thank you for your quick response!
The workaround above has fixed my issue.