We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Annotation quadpoints disorder

After version 22.1 was changed quapoints order.
Points order befor 22.1 version:
[0] - llx, ury
[1] - urx, ury
[2] - llx, lly
[3] - urx, lly

Points order after 22.1 version: (the second and the third points are reversed):
[0] - llx, ury
[1] - urx, ury
[2] - urx, lly
[3] - llx, lly

As a result we got this issue:
22.2 version result.png (17.0 KB)
For version 21.8 it looks like that:
21.8 version result.png (17.4 KB)

Code snippet

	@Test
	void quadPointsDisorder() throws IOException {
		var inputStream = new ClassPathResource("example.pdf").getInputStream();
		var pdfDocument = new Document(inputStream);
		var page = pdfDocument.getPages().get_Item(1);
		var rectangle = new Rectangle(72, 757.351074396976, 122.10035337124, 769.451074659236);

		var annotation = new RedactionAnnotation(page, rectangle);
		var quadPoints = toQuadPoints(rectangle);
		annotation.setQuadPoints(quadPoints);
		annotation.redact();
		page.getAnnotations().add(annotation);

		pdfDocument.save("result.pdf");
	}

	private Point[] toQuadPoints(Rectangle rectangle) {
		var quadPoints = new Point[4];
		quadPoints[0] = new Point(rectangle.getLLX(), rectangle.getURY());
		quadPoints[1] = new Point(rectangle.getURX(), rectangle.getURY());
		quadPoints[2] = new Point(rectangle.getLLX(), rectangle.getLLY());
		quadPoints[3] = new Point(rectangle.getURX(), rectangle.getLLY());

		return quadPoints;
	}

Java version: 11
Aspose PDF version: 22.2
Original file: example.pdf (20.6 KB)

@dkuksa

We have tested the scenario using the latest version of Aspose.PDF for Java 22.3 and have not found the shared issue. So, please use Aspose.PDF for Java 22.3.

No. Maven couldn’t see version 22.3 for some reason

@dkuksa

Could you please share the detail about issue that you are facing? The same version of Aspose.PDF for Java is available at maven : Aspose.PDF for Java 22.3.