-1

I'm currently trying to generate PDF with PDFBox for some manual cover and I was wondering if it was possible to take a precise zone of text in my PDF and move it (to the left) depending on my manuel thickness (which will be determined by the number of pages my manual will have)

I manage to create my PDF just fine, but I did not find a way to get only a block of text.

Is it possible to do so with PDFBox?

Note : I tried to search on the web and on other questions, but none of them were useful.

Thanks

Kaptin
  • 41
  • 7
  • Have you created that *zone of text* in a single, continuous block of operations? Or are the respective operations intermingled with operations created for material which shall not move? – mkl Aug 12 '14 at 06:31
  • I can't tell you, the whole thing was imported as one (i did not choose the text and image). We did not manage to find an easy solution to move text in an existing PDF files, so we decided to create one from scratch (will be way more easier). Sorry to have bother you guys ! Editing a PDF is not a simple task ! Creating a new one is easier. Thanks to you! – Kaptin Aug 12 '14 at 13:42
  • So the original question was about changing an existing file? I hadn't understood it that way. – Tilman Hausherr Aug 12 '14 at 15:41
  • We "create" a manual cover by importing some data, then we wanted to move the text that would have been on the back cover depending on the thickness of the book. Sorry if my question wasn't very accurate :S – Kaptin Aug 13 '14 at 16:11

2 Answers2

0

Wrap saveGraphicsState() and restoreGraphicsState() around that block. Within that, use moveTextPositionByAmount() (after beginText() !) or setTextTranslation() or (more general) concatenate2CTM(1, 0, 0, 1, tx, ty) to move the position.

Tilman Hausherr
  • 17,731
  • 7
  • 58
  • 97
  • Hhmmm, @Kaptin talks about a *zone of text*; it is not clear from the question that that *zone* is created by a block of operations to shift like you propose. – mkl Aug 12 '14 at 06:29
0

Like i said in a comment, we decided to create a new PDF with the informations needed instead of trying to edit an existing one.

We tried to edit the PDF but in vein and when we decided to start from scratch, it was way more easier to do so.

Thanks to the people who tried to help me !

Kaptin
  • 41
  • 7