Aspose Words barcode generation doesnt provide symbol height or scaling info

Hi,

I am trying to implement a custom barcodegenerator as explained here: Generate Custom BarCode for DISPLAYBARCODE|Aspose.Words for Java

However, with a Word field with following code: QR-Code.docx (65.3 KB)

{ DisplayBarcode " 23cd" QR \q 3 \h 200 \s 50}

I don’t get the \h and \s values in my custom barcode generator:
Barcodeparameters.jpeg (31.7 KB)

Thanks.

@avandenhoogen please, help me to understand correctly your issue:
Are you looking to extract the values of \h and \s when reading a Word document using the Aspose.Words API? Or, do you intend to set those values within a custom barcode generator?

@avandenhoogen As I can see Aspose.Words properly returns values of \h and \s switches, that corresponds BarcodeParameters.getSymbolHeight() and BarcodeParameters.getScalingFactor() properties respectively. You can check this using the following code:

Document doc = new Document("C:\\Temp\\in.docx");
doc.getFieldOptions().setBarcodeGenerator(new TestBarcodeGenerator());
doc.updateFields();
private static class TestBarcodeGenerator implements IBarcodeGenerator
{
    @Override
    public BufferedImage getBarcodeImage(BarcodeParameters parameters) throws Exception {
        System.out.println("h=" + parameters.getSymbolHeight());
        System.out.println("s=" + parameters.getScalingFactor());
        return null;
    }

    @Override
    public BufferedImage getOldBarcodeImage(BarcodeParameters parameters) throws Exception {
        return null;
    }
}

FYI @eduardo.canal

1 Like