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

Free Support Forum - aspose.com

Issue on TextFragment.Margin with justify

I have an requirement to apply the indent and justify the paragraph text, so I have applied the margin for the TextFragment and applied the justify property. But the right side text was went to out of the page and showed like a trimmed some text on right side.

If I used table cell and apply the margin for cell and justify the cell text it is working but page size was increased and performance was decreased so we are not recommended for table approach.

Below is my code snippet.

Document pdfDoc = new Document();
        pdfDoc.PageInfo.Width = 612.0;
        pdfDoc.PageInfo.Height = 792.0;
        pdfDoc.PageInfo.Margin = new MarginInfo();
        pdfDoc.PageInfo.Margin.Left = 72;
        pdfDoc.PageInfo.Margin.Right = 72;
        pdfDoc.PageInfo.Margin.Top = 72;
        pdfDoc.PageInfo.Margin.Bottom = 72;
    Page pdfPage = pdfDoc.Pages.Add();
    pdfPage.PageInfo.Width = 612.0;
    pdfPage.PageInfo.Height = 792.0;
    pdfPage.PageInfo.Margin = new MarginInfo();
    pdfPage.PageInfo.Margin.Left = 72;
    pdfPage.PageInfo.Margin.Right = 72;
    pdfPage.PageInfo.Margin.Top = 72;
    pdfPage.PageInfo.Margin.Bottom = 72;

    TextFragment textfragment = new TextFragment("This line for verify the indent");
    textfragment.TextState.FontSize = 12;
    textfragment.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");
    textfragment.TextState.LineSpacing = 15;
    pdfPage.Paragraphs.Add(textfragment);

    textfragment = new TextFragment("TextFragment with Justify : This AGREEMENT AND PLAN OF MERGER (this \"Agreement\") is made and entered into as of ______ __, ____, by and among ___________________, a Delaware corporation (\"Parent\"),___________________, a Delaware corporation and a wholly owned subsidiary of Parent (\"MergerSub\"), and ___________________, a Delaware corporation (the \"Company\").");
    textfragment.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
    textfragment.TextState.FontSize = 12;
    textfragment.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");
    textfragment.TextState.LineSpacing = 15;
    //for ss_indent I have given 10f left indent into text fragment.
    textfragment.Margin = new MarginInfo(10f, 0f, 0f, 0f);
    pdfPage.Paragraphs.Add(textfragment);

    textfragment = new TextFragment("TextFragment without Justify : This AGREEMENT AND PLAN OF MERGER (this \"Agreement\") is made and entered into as of ______ __, ____, by and among ___________________, a Delaware corporation (\"Parent\"),___________________, a Delaware corporation and a wholly owned subsidiary of Parent (\"MergerSub\"), and ___________________, a Delaware corporation (the \"Company\").");
    textfragment.TextState.FontSize = 12;
    textfragment.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");
    textfragment.TextState.LineSpacing = 15;
    //for ss_indent I have given 10f left indent into text fragment.
    textfragment.Margin = new MarginInfo(10f, 0f, 0f, 0f);
    pdfPage.Paragraphs.Add(textfragment);</code></pre>

Hi Srinivas,


Thanks for your inquiry. We have already noticed the issue in reference to your stackoverflow query and logged it in our issue tracking system as PDFNEWNET-39105 for investigation and correction. We will notify you as soon as we resolve it.

We are sorry for the inconvenience caused.

Best Regards,

Can I please get a status on PDFNEWNET-39105? This was opened in July and I’m just following up.


Thanks,
Srini

Hi Srinivas,


Thanks for your patience.

We do understand the inconvenience which you have been facing but I am afraid the problem is still not resolved. As soon as we have some further updates, we will let you know.

The issues you have found earlier (filed as PDFNET-39105) have been fixed in Aspose.PDF for .NET 18.12.