PDF417 zxing ライブラリをテストしていますが、出力のサイズ変更が期待どおりに機能しません。出力の縦横比は常に同じです。
寸法を変更しても出力には影響しません。他のメッセージで提案されているように EncodeHintType を試しましたが、成功しませんでした。ここにコード:
public class PDF417demo {
public static void main(String[] args) {
String barcodeMessage = "test";
final String PATH = "/home/test/";
final int WIDTH = 30;
BitMatrix bitMatrix;
Writer writer;
try {
Map hints = new HashMap();
hints.put(EncodeHintType.MARGIN, 2);
hints.put(EncodeHintType.PDF417_DIMENSIONS, new Dimensions(20,100,20,100) );
writer = new PDF417Writer();
bitMatrix = writer.encode(barcodeMessage, BarcodeFormat.PDF_417, WIDTH, WIDTH/2, hints);
MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File(PATH + "pdf417_demo.png")));
System.out.println("PDF417 Code Generated.");
} catch (Exception e) {
System.out.println("Exception Found." + e.getMessage());
}
}
}
その方法を教えてください。前もって感謝します。ニック