iText 5

How to move the content inside a rectangle inside an existing PDF? | iText 5 PDF Development Guide

My goal is to move text in a PDF around, which is within a certain rectangular area. All content matching the area in the original PDF should be shifted somewhat in the x and y direction. I have no influence on how the PDFs are created and I can accept a solution that only vaguely works.

Posted on StackOverflow on Feb 6, 2015 by tom_ink

Suppose that you have a PDF document like this:

Original PDF
Original PDF

I also have the coordinates of a rectangle: new Rectangle(100, 500, 200, 600); and an offset: move everything in that rectangle 10 points to the left and 2 points to the bottom, like this:

Manipulated PDF
Manipulated PDF

That is fairly easy to achieve. Take a look at the CutAndPaste example:

We've encountered an issue exporting this macro. Please try exporting again later.