0

I am looking for a way to edit an existing PDF to change the alignment of text blocks. Specifically I want to change the alignment from left alignment to fully justified.

Is there any way to do this using iTextSharp or similar?

FYI the PDF would have originally been created by SQL Reporting Services.

Alexis Pigeon
  • 7,423
  • 11
  • 39
  • 44
  • 2
    To begin with, this is not trivial. As you seem to be coping with very special PDFs, though, it might prove not to be too difficult after all. Some questions will have to be answered first, though. How can text to realign be differentiated from other text? How can text belonging to one block be recognized? Is the width into which the blocks shall be justified always the same (e.g. the page width minus fixed margins left and right?) Can you provide representative sample files? – mkl Jun 14 '13 at 12:27
  • @mkl they are good questions. I would have to find a way of identifyinig the text blocks to be justified. I could do something like add a special character just as ~!J~ or something at the start of the text (assuming I could remove that special text as part of the processing. – user2485956 Jun 14 '13 at 12:31
  • @mkl for the width it would be the width of the text box inserted by SSRS but I am not familiar with how that actually ends up in the PDF. Alternatively I could provide the width in my special tag perhaps if that would help. e.g. ~!J200~ – user2485956 Jun 14 '13 at 12:33
  • @mkl here is a sample PDF: http://www.filedropper.com/cars which was created by SSRS. The text block is the width of the table above it and ideally I would like the text justified to the table above – user2485956 Jun 14 '13 at 12:36
  • Such special markers with considerable width are not such a good idea. After removing them they leave quite a lot of unused space behind which after adjusting the block makes the given line really ugly. Furthermore I'm afraid there is nothing left of the SSRS text box but the pure text, especially no width information. Actually, looking into the page content, though, SSRS creates a clip path which seems to have the dimensions of its text box, and that clip path and all the text lines are enveloped between a q-Q operator pair (push and pop the graphics state). So perhaps not too difficult... – mkl Jun 14 '13 at 13:35

0 Answers0