Index: /applications/editors/josm/plugins/pdfimport/src/pdfimport/FilePlacement.java
===================================================================
--- /applications/editors/josm/plugins/pdfimport/src/pdfimport/FilePlacement.java	(revision 24190)
+++ /applications/editors/josm/plugins/pdfimport/src/pdfimport/FilePlacement.java	(revision 24191)
@@ -142,5 +142,5 @@
 			}
 		} else {
-			return tr("Transform error: Unsupported variant.");
+			//all fine
 		}
 
@@ -154,20 +154,20 @@
 					(this.maxNorth - this.minNorth) /  (this.maxY - this.minY));
 			this.transform.translate(-this.minX, -this.minY);
-		} else if (this.minEast < this.maxEast && this.minNorth > this.maxNorth) {
+		} else if (this.minEast > this.maxEast && this.minNorth < this.maxNorth) {
 			//need to rotate 90 degrees counterclockwise
 			this.transform = new AffineTransform();
 			//transform to 0..1, 0..1 range
 			this.transform.preConcatenate(AffineTransform.getTranslateInstance(-this.minX, -this.minY));
-			this.transform.preConcatenate(AffineTransform.getScaleInstance(1/(this.maxX - this.minX), 1/(this.minY - this.maxY)));
-
-			//rotate -90 degs around center
-			this.transform.preConcatenate(AffineTransform.getQuadrantRotateInstance(-1,  0.5, 0.5));
+			this.transform.preConcatenate(AffineTransform.getScaleInstance(1/(this.maxX - this.minX), 1/(this.maxY - this.minY)));
+
+			//rotate -90 degs around min
+			this.transform.preConcatenate(AffineTransform.getQuadrantRotateInstance(1,  0, 0));
 
 			//transform back to target range
 			this.transform.preConcatenate(AffineTransform.getScaleInstance(
-					(this.maxEast - this.minEast),
-					(this.minNorth - this.maxNorth)));
-			this.transform.preConcatenate(AffineTransform.getTranslateInstance(this.minEast, this.maxNorth));
-		} else if (this.minEast > this.maxEast && this.minNorth < this.maxNorth) {
+					(this.minEast - this.maxEast),
+					(this.maxNorth - this.minNorth)));
+			this.transform.preConcatenate(AffineTransform.getTranslateInstance(this.minEast, this.minNorth));
+		} else if (this.minEast < this.maxEast && this.minNorth > this.maxNorth) {
 			//need to rotate 90 degrees clockwise
 			this.transform = new AffineTransform();
@@ -176,12 +176,12 @@
 			this.transform.preConcatenate(AffineTransform.getScaleInstance(1/(this.maxX - this.minX), 1/(this.maxY - this.minY)));
 
-			//rotate 90 degs around center
-			this.transform.preConcatenate(AffineTransform.getQuadrantRotateInstance(1, 0.5, 0.5));
+			//rotate 90 degs around min
+			this.transform.preConcatenate(AffineTransform.getQuadrantRotateInstance(-1, 0, 0));
 
 			//transform back to target range
 			this.transform.preConcatenate(AffineTransform.getScaleInstance(
-					(this.minEast - this.maxEast),
-					(this.maxNorth - this.minNorth)));
-			this.transform.preConcatenate(AffineTransform.getTranslateInstance(this.maxEast, this.minNorth));
+					(this.maxEast - this.minEast),
+					(this.minNorth - this.maxNorth)));
+			this.transform.preConcatenate(AffineTransform.getTranslateInstance(this.minEast, this.minNorth));
 		}
 		else
Index: /applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java
===================================================================
--- /applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java	(revision 24190)
+++ /applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java	(revision 24191)
@@ -132,4 +132,6 @@
 
 	private LoadProgressRenderer progressRenderer;
+	private JCheckBox limitPathCountCheck;
+	private JTextField limitPathCount;
 
 
@@ -243,4 +245,6 @@
 		this.removeParallelSegmentsTolerance = new JTextField("3");
 
+		this.limitPathCountCheck = new JCheckBox(tr("Take only first X paths"));
+		this.limitPathCount = new JTextField("10000");
 
 		JPanel configPanel = new JPanel(new GridBagLayout());
@@ -274,10 +278,16 @@
 		configPanel.add(this.removeParallelSegmentsTolerance, c);
 
-		c.gridx = 0; c.gridy = 4; c.gridwidth = 1;
+
+		c.gridx = 0; c.gridy = 4; c.gridwidth = 2;
+		configPanel.add(this.limitPathCountCheck, c);
+		c.gridx = 2; c.gridy = 4; c.gridwidth = 1;
+		configPanel.add(this.limitPathCount, c);
+
+		c.gridx = 0; c.gridy = 5; c.gridwidth = 1;
 		configPanel.add(this.colorFilterCheck, c);
-		c.gridx = 2; c.gridy = 4; c.gridwidth = 1;
+		c.gridx = 2; c.gridy = 5; c.gridwidth = 1;
 		configPanel.add(this.colorFilterColor, c);
 
-		c.gridx = 0; c.gridy = 5; c.gridwidth = 2;
+		c.gridx = 0; c.gridy = 6; c.gridwidth = 2;
 		configPanel.add(this.debugModeCheck, c);
 
@@ -615,4 +625,5 @@
 		double nodesTolerance = 0.0;
 		Color color = null;
+		int maxPaths = Integer.MAX_VALUE;
 
 		if (this.mergeCloseNodesCheck.isSelected()) {
@@ -643,4 +654,17 @@
 		}
 
+		if (this.limitPathCountCheck.isSelected()) {
+			try {
+				maxPaths = Integer.parseInt(this.limitPathCount.getText());
+			}
+			catch (Exception e) {
+				JOptionPane
+				.showMessageDialog(
+						Main.parent,
+						tr("Could not parse max path count"));
+				return null;
+			}
+		}
+
 
 		monitor.setTicks(10);
@@ -651,5 +675,5 @@
 		try {
 			PdfBoxParser parser = new PdfBoxParser(data);
-			parser.parse(fileName, monitor.createSubTaskMonitor(80, false));
+			parser.parse(fileName, maxPaths, monitor.createSubTaskMonitor(80, false));
 
 		} catch (FileNotFoundException e1) {
Index: /applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/GraphicsProcessor.java
===================================================================
--- /applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/GraphicsProcessor.java	(revision 24190)
+++ /applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/GraphicsProcessor.java	(revision 24191)
@@ -22,5 +22,5 @@
 
 	public PathOptimizer target;
-	private Shape clipShape;
+	private Shape  clipShape;
 	private List<PdfPath> clipPath;
 	private final LayerInfo info = new LayerInfo();
@@ -31,7 +31,10 @@
 	private final AffineTransform transform;
 	private final ProgressMonitor monitor;
-
-	public GraphicsProcessor(PathOptimizer target, int rotation, ProgressMonitor monitor)
+	private final int maxPaths;
+
+
+	public GraphicsProcessor(PathOptimizer target, int rotation, int maxPaths, ProgressMonitor monitor)
 	{
+		this.maxPaths = maxPaths;
 		this.target = target;
 		this.transform = new AffineTransform();
@@ -44,4 +47,11 @@
 
 	private void addPath(Shape s, boolean closed) {
+		pathNo ++;
+		this.monitor.setCustomText(tr(" {0} objects so far", pathNo));
+
+		if (pathNo >= maxPaths) {
+			return;
+		}
+
 		List<PdfPath> paths = this.parsePath(s, closed);
 
@@ -50,5 +60,4 @@
 		}
 
-		pathNo ++;
 
 		if (paths.size() > 1) {
@@ -60,5 +69,4 @@
 		}
 
-		this.monitor.setCustomText(tr(" {0} objects so far", pathNo));
 	}
 
@@ -179,6 +187,6 @@
 
 
-	public void setClip(Shape clip) {
-		if (this.clipShape == clip)
+	public void setClip(Shape  clip) {
+		if (this.shapesEqual(this.clipShape,clip))
 			return;
 
@@ -203,4 +211,14 @@
 
 
+	private boolean shapesEqual(Shape shape1, Shape shape2) {
+
+		if (shape1== null || shape2 == null){
+			return false;
+		}
+
+		return shape1.getBounds2D().equals(shape2.getBounds2D());
+	}
+
+
 	public void setStroke(Stroke s) {
 		BasicStroke stroke = (BasicStroke) s;
Index: /applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/PdfBoxParser.java
===================================================================
--- /applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/PdfBoxParser.java	(revision 24190)
+++ /applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/PdfBoxParser.java	(revision 24191)
@@ -23,5 +23,5 @@
 
 	@SuppressWarnings("unchecked")
-	public void parse(File file, ProgressMonitor monitor) throws Exception
+	public void parse(File file, int maxPaths, ProgressMonitor monitor) throws Exception
 	{
 		monitor.beginTask(tr("Parsing PDF", 1));
@@ -47,5 +47,5 @@
 		}
 
-		GraphicsProcessor p = new GraphicsProcessor(target, rotation, monitor);
+		GraphicsProcessor p = new GraphicsProcessor(target, rotation, maxPaths, monitor);
 		PageDrawer drawer = new PageDrawer();
 		drawer.drawPage(p, page);
