We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

BarCodeException "Required size is not allowed. Barcode can not be so small"

When converting a docx file containing a QR barcode, we are getting the BarCodeException “Required size is not allowed. Barcode can not be so small.”

The exception is raised within your sample class “CustomBarcodeGenerator” - https://docs.aspose.com/display/wordsnet/How+to+Generate+a+Custom+BarCode+Image+for+DISPLAYBARCODE+Field

We are using Aspose.Barcode version 19.10 (with .NET 4.0).

I’ve attached the code and the docx file to this message.SSCCE2.zip (20.2 KB)

Please advise how we may overcome this error.


I have reviewed the sample code and observed that if we use scale value 0.4, it creates too small QRCode which cannot be detected properly. You may please set this value to 1 or greater than this which will create proper output file. We will update this example soon to create appropriate output file.

const float scale = 1.0f; // Empiric scaling factor for converting Word barcode to Aspose.BarCode

Your suggested fix does indeed produce a QR code but I don’t believe it is the correct size. If I use MS Word and save the DOCX as PDF, the QR code is much bigger.

Can you please advise how I can make the QR code created by Aspose.Barcode the same size as that created by MS Word?

We are looking into this requirement and will write back here once feedback is ready to share.