如何使用java设置生成的pdf417条形码的宽度



嗨,我正在生成pdf417条形码。为此,我关注了这个链接。

try { 
             String a = "Microsoft";
             String b = "wkejew";
                PDF417 barcode = new PDF417(); 
                barcode.setData(a+b); 
               // barcode.setData(a);
                ServletOutputStream servletoutputstream = response.getOutputStream(); 
                response.setContentType("image/gif"); 
                response.setHeader("Pragma", "no-cache"); 
                response.setHeader("Cache-Control", "no-cache"); 
                response.setDateHeader("Expires", 0); 
                barcode.drawBarcode(servletoutputstream);
 } catch (Exception e) { 
                throw new ServletException(e); 
            }

所以现在的问题是我得到的条形码有很多宽度。那么我可以减小宽度吗?

从您的链接:

如何设置生成的条形码PDF-417图像的宽度和高度?顶部

您可以通过属性barcodeWidth和barcodeHeight值设置条形码图像的宽度和高度

或者您可以设置X(条形模块宽度)和Y(条形模块高度)值

最新更新