fix groovy x/y scale barcode rendering

This commit is contained in:
Jörg Prante 2021-12-09 18:53:32 +01:00
parent 10a401731f
commit 49332d85d5
3 changed files with 6 additions and 6 deletions

View file

@ -231,7 +231,8 @@ class ParagraphRenderer implements Renderable {
float width = barcode.width float width = barcode.width
float height = barcode.height float height = barcode.height
PdfBoxGraphics2D pdfBoxGraphics2D = new PdfBoxGraphics2D(pdfDocument.pdDocument, width, height) PdfBoxGraphics2D pdfBoxGraphics2D = new PdfBoxGraphics2D(pdfDocument.pdDocument, width, height)
BarcodeGraphicsRenderer renderer = new BarcodeGraphicsRenderer(pdfBoxGraphics2D, null, 1.0d, BarcodeGraphicsRenderer renderer = new BarcodeGraphicsRenderer(pdfBoxGraphics2D, null,
1.0d, 1.0d,
java.awt.Color.WHITE, java.awt.Color.BLACK, false, false) java.awt.Color.WHITE, java.awt.Color.BLACK, false, false)
renderer.render(symbol) renderer.render(symbol)
renderer.close() renderer.close()

View file

@ -92,8 +92,8 @@ class PdfBoxBarcodeTest {
BufferedImage bufferedImage = new BufferedImage(width as int, height as int, BufferedImage.TYPE_BYTE_GRAY) BufferedImage bufferedImage = new BufferedImage(width as int, height as int, BufferedImage.TYPE_BYTE_GRAY)
Graphics2D g2d = bufferedImage.createGraphics() Graphics2D g2d = bufferedImage.createGraphics()
Rectangle rectangle = new Rectangle(0, 0, width as int, height as int) Rectangle rectangle = new Rectangle(0, 0, width as int, height as int)
BarcodeGraphicsRenderer renderer = new BarcodeGraphicsRenderer(g2d, rectangle, 1.0d, BarcodeGraphicsRenderer renderer = new BarcodeGraphicsRenderer(g2d, rectangle,
Color.WHITE, Color.BLACK, false, false) 1.0d, 1.0d, Color.WHITE, Color.BLACK, false, false)
renderer.render(code3Of9) renderer.render(code3Of9)
renderer.close() renderer.close()
PDImageXObject img = LosslessFactory.createFromImage(document, bufferedImage) PDImageXObject img = LosslessFactory.createFromImage(document, bufferedImage)
@ -120,8 +120,8 @@ class PdfBoxBarcodeTest {
void create(float x, float y, float width, float height, Code3Of9 code3Of9) { void create(float x, float y, float width, float height, Code3Of9 code3Of9) {
PdfBoxGraphics2D pdfBoxGraphics2D = new PdfBoxGraphics2D(document, width, height) PdfBoxGraphics2D pdfBoxGraphics2D = new PdfBoxGraphics2D(document, width, height)
Rectangle rectangle = new Rectangle(0, 0, width as int, height as int) Rectangle rectangle = new Rectangle(0, 0, width as int, height as int)
BarcodeGraphicsRenderer renderer = new BarcodeGraphicsRenderer(pdfBoxGraphics2D, rectangle, 1.0d, BarcodeGraphicsRenderer renderer = new BarcodeGraphicsRenderer(pdfBoxGraphics2D, rectangle,
Color.WHITE, Color.BLACK, false, false) 1.0d, 1.0d, Color.WHITE, Color.BLACK, false, false)
renderer.render(code3Of9) renderer.render(code3Of9)
renderer.close() renderer.close()
PDFormXObject xFormObject = pdfBoxGraphics2D.getXFormObject() PDFormXObject xFormObject = pdfBoxGraphics2D.getXFormObject()

View file

@ -67,7 +67,6 @@ public abstract class TestUtils {
assertEquals(expectedFrags.size(), actualFrags.size()); assertEquals(expectedFrags.size(), actualFrags.size());
} }
@SuppressWarnings("serial")
public static class Template extends LinkedList<Object> { public static class Template extends LinkedList<Object> {
public Template(Object[] lines) { public Template(Object[] lines) {
Collections.addAll(this, lines); Collections.addAll(this, lines);