Index: /applications/editors/josm/plugins/print/.classpath
===================================================================
--- /applications/editors/josm/plugins/print/.classpath	(revision 33117)
+++ /applications/editors/josm/plugins/print/.classpath	(revision 33118)
@@ -2,6 +2,8 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="test/unit"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: /applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintDialog.java
===================================================================
--- /applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintDialog.java	(revision 33117)
+++ /applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintDialog.java	(revision 33118)
@@ -15,6 +15,8 @@
 import java.awt.print.PrinterException;
 import java.awt.print.PrinterJob;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.text.ParseException;
@@ -58,4 +60,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.Utils;
 import org.openstreetmap.josm.tools.WindowGeometry;
 
@@ -490,5 +493,5 @@
 
     @SuppressWarnings("unchecked")
-    protected Attribute unmarshallPrintSetting(Collection<String> setting) throws
+    static Attribute unmarshallPrintSetting(Collection<String> setting) throws
         ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
 
@@ -505,4 +508,5 @@
         } else if (syntax.equals(EnumSyntax.class)) {
             int intValue = Integer.parseInt(value);
+            // First method - access static enum fields by reflection for classes that do not implement getEnumValueTable
             for (Field f : realClass.getFields()) {
                 if (Modifier.isStatic(f.getModifiers()) && category.isAssignableFrom(f.getType())) {
@@ -513,5 +517,15 @@
                 }
             }
-            throw new IllegalArgumentException("Invalid enum: "+realClass+" - "+value);
+            // Second method - get instance from getEnumValueTable by reflection
+            try {
+                Method getEnumValueTable = realClass.getDeclaredMethod("getEnumValueTable");
+                Constructor<? extends Attribute> constructor = realClass.getDeclaredConstructor(int.class);
+                Utils.setObjectsAccessible(getEnumValueTable, constructor);
+                Attribute fakeInstance = constructor.newInstance(Integer.MAX_VALUE);
+                EnumSyntax[] enumTable = (EnumSyntax[]) getEnumValueTable.invoke(fakeInstance);
+                return (Attribute) enumTable[intValue];
+            } catch (ReflectiveOperationException | ArrayIndexOutOfBoundsException e) {
+                throw new IllegalArgumentException("Invalid enum: "+realClass+" - "+value, e);
+            }
         } else if (syntax.equals(IntegerSyntax.class)) {
             return realClass.getConstructor(int.class).newInstance(Integer.parseInt(value));
Index: /applications/editors/josm/plugins/print/test/unit/org/openstreetmap/josm/plugins/print/PrintDialogTest.java
===================================================================
--- /applications/editors/josm/plugins/print/test/unit/org/openstreetmap/josm/plugins/print/PrintDialogTest.java	(revision 33118)
+++ /applications/editors/josm/plugins/print/test/unit/org/openstreetmap/josm/plugins/print/PrintDialogTest.java	(revision 33118)
@@ -0,0 +1,52 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.print;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+
+import javax.print.attribute.standard.OrientationRequested;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+/**
+ * Unit test of {@link PrintDialog} class.
+ */
+public class PrintDialogTest {
+
+    /**
+     * Setup test.
+     */
+    @Rule
+    public JOSMTestRules rules = new JOSMTestRules().preferences();
+
+    /**
+     * Unit test of {@link PrintDialog#unmarshallPrintSetting}
+     * @throws ReflectiveOperationException if an error occurs
+     */
+    @Test
+    public void testUnmarshallPrintSetting() throws ReflectiveOperationException {
+        assertEquals(OrientationRequested.PORTRAIT, PrintDialog.unmarshallPrintSetting(Arrays.asList(
+                "javax.print.attribute.standard.OrientationRequested",
+                "javax.print.attribute.standard.OrientationRequested",
+                "javax.print.attribute.EnumSyntax",
+                "3")));
+    }
+
+    /**
+     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/13302">#13302</a>
+     * @throws ReflectiveOperationException if an error occurs
+     */
+    @Test
+    @Ignore("not fixed yet")
+    public void testTicket13302() throws ReflectiveOperationException {
+        assertEquals(OrientationRequested.PORTRAIT, PrintDialog.unmarshallPrintSetting(Arrays.asList(
+                "javax.print.attribute.standard.MediaSizeName",
+                "sun.print.CustomMediaSizeName",
+                "javax.print.attribute.EnumSyntax",
+                "82")));
+    }
+}
