2013-12-11 92 views
1

我正在嘗試使用iTextSharp創建2d Datamatrix條形碼。如果我不提供高度或寬度,則條形碼會生成很好。但是,當我嘗試設置條碼的高度和寬度時,它會返回空對象。iTextSharp datamatrix條形碼在設置高度/寬度時返回null

 BarcodeDatamatrix barcode = new BarcodeDatamatrix 
             { 
              Width = 10, 
              Height = 10 
             }; 

     barcode.Generate(barcodeData); 
     Image barcodeImage = barcode.CreateImage(); 
     return barcodeImage; 
    } 

爲什麼它返回null,我怎樣才能設置我的尺寸?

+0

需要注意兩個不同的尺寸:圖像的像素尺寸和datamatrix條形碼的平方尺寸。後者只接受規範中定義的特定組合,它會影響您可以在條碼中存儲多少數據。 – acfrancis

回答