Free Support Forum -

Convert doc with barcode to PDF

I have the barcode with font WASP 39 M in the Word document. When view the doc, I see the barcode. But when I use doc.Save("abc.pdf"), in the PDF the barcode display as normal text. Do I have to purchase Aspose.Barcode and modify the code to convert the text to Barcode in word doc and then save it to PDF? I attach the original doc file.



Hi Tom-NHD,

Thank you for contacting Aspose.Words. The point here is, when you render documents to fixed-page formats e.g. PDF, Aspose.Words requires TrueType fonts to be installed on the system (OS).

So the workaround would be:

  • Please ensure, if the desired fonts are installed?
  • As some document formats such as DOCX can contain embedded fonts, please try to embed WASP 39 M font among the fonts embedded in the original document.
  • Instead of default location, if your font is located in some other directory then you have to specify the location of the folder that contains the font. The sample code snippet is as follows:

Document doc = new Document(MyDir + "Rendering.doc");

// Set fonts to be scanned for under the specified directory. Do not search within folders nested this folder.

FontSettings.SetFontsFolder(@"C:\MyFonts\", false);

doc.Save(MyDir + "SetFontsFolder Out.pdf");

I hope this will help.

Best regards,