From c1f5ebd409c9e820b9538c96907ef4f5f6a18556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Tue, 1 Feb 2022 16:18:09 +0100 Subject: [PATCH] bug fix - we must ignore if type does not exist --- .../xbib/graphics/pdfbox/layout/element/scripting/Engine.java | 3 ++- .../layout/text/annotations/AnnotationDrawListener.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/Engine.java b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/Engine.java index d2c13ee..d802981 100644 --- a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/Engine.java +++ b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/Engine.java @@ -57,7 +57,8 @@ public class Engine { private void executeSettings(Settings settings) throws IOException { String type = settings.get("type"); if (type == null) { - throw new IllegalArgumentException("missing type in " + settings.getAsMap()); + // silently ignore + return; } try { String className = packageName + ".command." + type.substring(0, 1).toUpperCase() + type.substring(1) + "Command"; diff --git a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/text/annotations/AnnotationDrawListener.java b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/text/annotations/AnnotationDrawListener.java index ac74a1d..5f3ab4c 100644 --- a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/text/annotations/AnnotationDrawListener.java +++ b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/text/annotations/AnnotationDrawListener.java @@ -2,8 +2,10 @@ package org.xbib.graphics.pdfbox.layout.text.annotations; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; +import org.apache.pdfbox.pdmodel.PDPageContentStream; import org.xbib.graphics.pdfbox.layout.element.render.RenderContext; import org.xbib.graphics.pdfbox.layout.element.render.RenderListener; +import org.xbib.graphics.pdfbox.layout.element.render.Transform; import org.xbib.graphics.pdfbox.layout.text.Alignment; import org.xbib.graphics.pdfbox.layout.text.DrawContext; import org.xbib.graphics.pdfbox.layout.text.DrawListener; @@ -12,7 +14,7 @@ import org.xbib.graphics.pdfbox.layout.position.Position; /** * This listener has to be passed to all - * {@link DrawableText#drawText(org.apache.pdfbox.pdmodel.PDPageContentStream, Position, Alignment, DrawListener) + * {@link DrawableText#drawText(PDPageContentStream, Position, Transform, Alignment, DrawListener)} * draw()} methods, in order collect all annotation metadata. After all drawing * is done, you have to call {@link #afterRender()} which creates all * necessary annotations and sets them to the corresponding pages. This listener