【问题标题】:How do I numerically position a barcode in reportlab?如何在reportlab中以数字方式定位条形码?
【发布时间】:2015-05-12 05:59:08
【问题描述】:

我有一个具体的案例,我似乎无法找到解决方案。我正在 ReportLab for Python 中编写一个运输标签模板对象。我有以下代码可以将条形码创建为绘图。

uspsBarcode = createBarcodeDrawing('USPS_4State', value=self.imbval, routing=self.zip4.replace('-',''))
print uspsBarcode.getBounds() # print out of position and scale

使用该代码,我稍后将其添加到形状组,然后返回该形状组。所以我需要相对于对象定位条形码。即使我已经挖掘了继承,我似乎也找不到任何方法将定位传递给它。尽管从打印中可以看出,定位是设置在somwhere

【问题讨论】:

    标签: python reportlab


    【解决方案1】:

    仅适用于遇到此问题的其他任何人。事实证明,如果将条形码绘制在一个形状组中,那么形状组容器可以通过移位功能进行数字移动。

    uspsBarcode = shapes.Group()
    bc = createBarcodeDrawing('USPS_4State', value=self.imbVal, routing=self.zip4.replace('-',''))
    uspsBarcode.add(bc)
    uspsBarcode.shift(self.x+(s*0.2), self.y)
    

    【讨论】:

      猜你喜欢
      • 2016-12-18
      • 1970-01-01
      • 2014-07-19
      • 1970-01-01
      • 2018-02-07
      • 2017-09-05
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      相关资源
      最近更新 更多