Need to add dynamic text of line 1 or 2 and so on, at a specific place of an existing pdf, tried a lot of things but am unable to format properly
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(dataDir + "Test.pdf"); //Get first page Page page = document.Pages; 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 par.AppendLine(textFragment); //add the TextParagraph using TextBuilder TextBuilder textBuilder = new TextBuilder(page); textBuilder.AppendParagraph(par); document.Save(dataDir + "Test_19.4.pdf");
Moreover, you can also add a
TextStamp on any location of the page as explained in Adding Text Stamp .
i used the above code and after adding the text para it is getting overlapped to the next lines, instead of shifting the rest of pdf data down (below this para) , so everything could be visible…
Please note that Aspose.PDF mimics the behavior of Adobe Acrobat where content does not move or accommodate other contents while working with existing PDF documents. In case you are able to achieve same requirements with Adobe Acrobat then share the details along with respective documents so that we may investigate further.