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

Free Support Forum - aspose.com

How to set position about TextFragment?

How to set position about TextFragment?

I want to place TextFragment at a specific location with coordinates


Thank you for contacting support.

We would like to request you to use below code snippet in your environment and then share your kind feedback with us.

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

        TextFragment textFragment = new TextFragment();
        textFragment.Text = "ABCD";

        textFragment.Position.XIndent = 400;
        textFragment.Position.YIndent = 700;
        //create TextParagraph object
        TextParagraph par = new TextParagraph();

        //set paragraph position
        par.Position = new Position(textFragment.Position.XIndent, textFragment.Position.YIndent);

        //add new TextFragment to paragraph

        //add the TextParagraph using TextBuilder
        TextBuilder textBuilder = new TextBuilder(page);
        document.Save(dataDir + "Test_18.7.pdf");

Moreover, you can also add a TextStamp on any location of the page as explained in Adding Text Stamp in the PDF File.