Zxing pdf417 image size

I am testing PDF417 zxing libs files, but resizing the output does not work as I am exptected. The output always has the same aspect ratio.

Resizing does not affect the output, I tried EncodeHintType, as suggested in other posts, but without success. Here is the code:

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()); } } } 

Could you suggest me how to do this? Thank you in advance. Nic

+6
source share

Source: https://habr.com/ru/post/982207/


All Articles