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

Free Support Forum - aspose.com

FullJustify in a two column FloatingBox not working

Hi there

I’m trying to full justify text in a two column FloatingBox but the text appears as only left justified. What is the problem? Below is my code.

Many thanks, Brett.

    public static void CreateDualColumnFullJustifiedTextSample(Stream stream)
    {
        AsposeLicense.Set();

        var text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus purus ex, blandit vel tortor eu, efficitur facilisis massa. In id porta massa, nec condimentum turpis. Vivamus ac suscipit diam, non rutrum diam. Nunc ultrices sit amet libero at lacinia. Curabitur vitae est nec enim porta commodo vel id diam. Nullam faucibus nisi varius porttitor convallis. Aliquam luctus nisl magna, in elementum sapien sodales ut. Ut finibus quis nunc at condimentum. Vestibulum iaculis felis nec fringilla mollis. Vestibulum semper urna urna, sit amet congue lacus interdum vel. Fusce id lacus eleifend, dapibus ipsum eget, molestie lacus. Pellentesque ullamcorper nisi ac nulla cursus molestie.";

        var document = new Document();
        var page = document.Pages.Add();

        var info = page.PageInfo;
        var columnSpacing = 30d;
        var columnWidth = (info.Width - info.Margin.Left - info.Margin.Right - columnSpacing) / 2;

        var column = new FloatingBox((float)columnWidth, (float)info.PureHeight)
        {
            IsFirstParagraphInColumn = false,
            IsKeptWithNext = false,
            IsInLineParagraph = false,
            IsInNewPage = false,
            IsNeedRepeating = true,
            Top = 0
        };

        column.ColumnInfo.ColumnCount = 2;
        column.ColumnInfo.ColumnSpacing = $"{columnSpacing}";
        column.ColumnInfo.ColumnWidths = $"{columnWidth} {columnWidth}";

        for (var index = 0; index < 20; index++)
        {
            var fragment = new TextFragment(text) { HorizontalAlignment = HorizontalAlignment.FullJustify };
            fragment.TextState.Font = FontRepository.FindFont("Times");
            fragment.TextState.FontSize = 12;

            column.Paragraphs.Add(fragment);
            column.Paragraphs.Add(new TextFragment(Environment.NewLine));
        }

        page.Paragraphs.Add(column);

        document.Save(stream);
    }

@brettfisher

Thanks for contacting support.

We have tested the scenario while using Aspose.Pdf for .NET 17.10 and were able to replicate the issue in our environment. Therefore we have logged this issue as PDFNET-43511 in our issue tracking system. We will further look into the details of the issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

Hi there

Please move this issue to the Enterprise Support Forum.

Regards,
Brett

@brettfisher,

Thanks for contacting support.

I am afraid currently we cannot move the thread from free support forum to paid support. However you may consider creating a new thread in respective Paid support forum using your account and share the issue ID. The respective team will then raise the priority of issue accordingly.