Caption alignment not working

Hi,

I am trying to align the caption under my barcode to centre it but it isn’t working - any tips please?

@asosuk,

You can place a floating box in the specific region of the page, and then add the text fragment node into the floating box. The floating box accepts absolute positioning rather than flow layout (Top left to Bottom right) on the page. You can use Top, Left, Bottom and Right properties to adjust the position of a floating box. This is the code example to add a text fragment node into the floating box:

[C#]

string dataDir = @"C:\Pdf\test334\";
// Open document
Document pdfDocument = new Document(dataDir + "Input.pdf");
FloatingBox box = new FloatingBox();

TextFragment fragment = new TextFragment("Main Text");
fragment.Margin = new MarginInfo(0, 20, 0, 0);
fragment.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
fragment.TextState.Rotation = 90;
box.Paragraphs.Add(fragment);

pdfDocument.Pages[1].Paragraphs.Add(box);
pdfDocument.Save(dataDir + "Test_Out.pdf");