Does Aspose support any barcode fonts?

Does Aspose support any barcode fonts? We would like our customers to use templates where they can render text into barcodes. Could you let us know a barcode font and provider which we can utilise?

As shown in the first file attachment, here is the word document with the barcode font.

As shown in the second file attachment, this is the pdf output. It reverts to a base font.

Looking forward to hearing from you.
Screenshot 2023-08-15 1.jpg (43.8 KB)
Screenshot 2023-08-15 2.jpg (24.1 KB)

@it_tidyinternational, yes, Aspose.Words supports barcode fonts. For example, the attached document uses Libre Barcode 128 font, and, as you can see, PDF created by Aspose.Words is identical to PDF created by Microsoft Word:

in.aspose.words.pdf (5.6 KB)
in.word.pdf (9.3 KB)

The issue with barcode in PDF that you described might be caused by a missing barcode font. Could you try converting your document with barcode using the following program and check whether any font substitution warning are printed:

Document document = new Document("barcodedocument.docx");
document.WarningCallback = new HandleDocumentWarnings();
document.Save("output.pdf");

public class HandleDocumentWarnings : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        // We are only interested in fonts being substituted.
        if (info.WarningType == WarningType.FontSubstitution)
        {
            Console.WriteLine(info.WarningType + " :: " + info.Description.ToString());
        }
    }
}

in.aspose.words.pdf (5.55 KB)
in.docx (11.9 KB)
in.word.pdf (9.30 KB)

Hi Denis

Thank you very much for your reply.

I have run your code to check my document. The attached PDF file is the output.

As it works, would this indicate a problem on our end? Perhaps it is a versioning problem? I will double check to see what version we are using, what is the earliest version where this is supported?

Thanks for your support.
output.pdf (68.6 KB)

@it_tidyinternational Could you please clarify what is the problem with your output? The barcode is rendered in the provided document.

Hello Konstantin

If you refer to my first message, the problem is that our application (using Aspose.Words API) is not rendering the barcode.

In my first message, the first file attachment is what is sent up on my Word Template.

The second file attachment is the output of our application using Aspose API to convert it from Word to PDF.

Yes, the barcode is being rendered when I use Denis’ code, however that is independent of our application.

So, we are wondering if it is an issue with the Aspose product we are using, or if it is the Aspose version.

@it_tidyinternational As Denis mentioned most likely the problem on your side occurs because the barcode font required to render barcode is not present in your environment. Have you tries to impalement IWarningCallback as Denis suggested? Does it show warnings about font substitutions?
It is not likely, the problem is related to Aspose.Words version used in your application. But you can specify the version used on your side and we will check on the same version on our side.

Hi Alexey

Following up on this now, apologies for the delay in getting back to you. I am now able to focus on this and move this forward.

When I run the code that Denis provided, I received no font substitution warning and the barcode rendered on the document.

So that may confirm a problem on our side. I can confirm the Version we are using is Aspose.Words Cloud Version 23.3.0.

Is this version compatible for the barcode fonts? Let us know if there is any further information we need to provide.

Kind Regards,

Sheldon

Hi Alexey

Just to confirm on the above, our application which doesn’t render the Barcode is using Aspose Words Cloud Version 23.3.0.

We ran your code with the exact same version (23.3.0) of Aspose Words separately and didn’t get the font substitution warning, the barcode displayed correctly on the document.

Kind Regards,

Sheldon

@it_tidyinternational I will move your request in Aspose Cloud forum. My colleagues from Cloud team will help you shortly.

@it_tidyinternational

You can upload your custom(barcode) font to a cloud storage folder and pass the cloud storage folder path in the ‘FontsLocation’ parameter in the API request while converting the document.