Paper Forms Barcode のデータの表示

Paper Forms Barcode の使用スニペットでは、Paper Forms Barcode の容量を示します。データ内に大文字と小文字が混在している場合や特殊文字がある場合の、データ容量の変化も示しています。

この例では、255 未満の文字数を入力し、「データを生成」ボタンをクリックすると、バーコードデータ容量が変化します。また、「大文字のみ使用」チェックボックスの選択を解除すると、大文字と小文字を混在させたときにバーコードのデータ容量が減少することがわかります。

「生成する文字数」テキストボックスのスクリプトを追加するには

form1.#subform[0].CharstoGen::validate - (JavaScript, client) 
// The maximum number of characters to generate is 255. 
if (this.rawValue > 255) 
{ 
    this.rawValue = 255; 
    false; 
}

「大文字のみ使用」チェックボックスのスクリプトを追加するには

form1.#subform[0].UpperCaseOnly::change - (JavaScript, client) 
if (this.rawValue == 1) 
{ 
    CharacterBase.value = " ABC DEF GHI JKL MNO PQR STU VWX YZ,"; 
} 
else 
{ 
    CharacterBase.value = " ABC DEF GHI JKL MNO PQR STU VWX YZa bcd efg hij klm nop qrs tuv wxy z01 234 567 890 <xml>,"; 
    xfa.host.messageBox("When data is encoded into a PDF417 barcode, all UPPER CASE data requires less space in a barcode.  When switching back and forth from upper case to lower case, special characters must be embedded into the barcode to let the decoder or scanner know that a case change has taken place.  As you will be able to see from the example, the data capacity of the barcode is reduced when mixed cases are used.", "Upper Case" ,3, 1); 
} 
 
if (CharstoGen.rawValue >= 255) 
    CharstoGen.rawValue = 255;

「データを生成」ボタンにスクリプトを追加するには

form1.#subform[0].Button1::click - (JavaScript, client) 
// Display random data in Paper Form barcode. 
var RandomLetters = ""; 
var sequence = ""; 
var FieldFillSize = 0; 
var nIndex = 0; 
 
RandomLetters = CharacterBase.value; 
FieldFillSize = CharstoGen.rawValue;         
 
for (var i = 1; i <= FieldFillSize; i++) 
{ 
    nIndex = Math.floor(Math.random() * RandomLetters.length); 
    sequence = sequence + RandomLetters.charAt(nIndex); 
} 
 
BarcodeData.rawValue = sequence;

バーコードにスクリプトを追加するには

BarcodeData.rawValue = sequence; 
    form1.#subform[0].Barcode::calculate - (JavaScript, client) 
//{{Start Generated Content// 
var is705ViewerRequired = false; 
//End Generated Content}}// 
 
function createBarcodeContent() 
{ 
       // TODO: Encode your barcode content here 
       var barcodeContent = " "; 
       barcodeContent = BarcodeData.rawValue; 
       return barcodeContent; 
} 
 
// Assign content to the barcode.  
// Note: Do not assign a null value to 
// the barcode. Otherwise, the barcode is 
// displayed as blank. 
if(createBarcodeContent() != null) 
{ 
       this.rawValue = createBarcodeContent(); 
} 
else 
{ 
       this.rawValue = " "; 
} 
// Final sanity check, located here not for  
// efficiency but for consistency and correctness 
if (is705ViewerRequired && xfa.host.version < 7.05) 
{ 
       this.rawValue = " "; 
}

同様の例については、LiveCycle デベロッパーセンターを参照してください。