我使用iText的創建PDF417條碼,像這樣:從CCITT格式轉換iText的條碼圖像爲PNG
private InputStream getBarcode() throws Exception {
BarcodePDF417 barcode = new BarcodePDF417();
barcode.setText("Sample bar code text");
Image image = barcode.getImage();
image.scalePercent(50, 50 * barcode.getYHeight());
return new ByteArrayInputStream(image.getRawData());
}
我需要通過barcode.getImage()
爲JPG,GIF返回CCITT格式轉換,或PNG,所以我可以將它包含在我在JasperReports中創建的文檔中。
感謝您的回覆。如果將來必須轉換圖像,我會保持您的代碼示例方便。原來我這次不需要轉換任何東西。 – Tom