Asad Ali April 23, 20180 Comments

Process Line Breaking and Create Clones of TextFragments with Aspose.PDF for .NET 18.4

Process Line Breaking and Create Clones of TextFragments with Aspose.PDF for .NET 18.4

April 23, 2018
Share on FacebookTweet about this on TwitterShare on LinkedIn

As per monthly update process of Aspose APIs, we are pleased to announce new April Release of Aspose.PDF for .NET. Aspose.PDF for .NET 18.4 is available on NuGet Gallery for download and to be used in .NET applications. Like every new release of the API, Aspose.PDF for .NET 18.4 has been launched with exciting features and enhancements. In order to have an overview of improvements and changes in this release of the API, we recommend you to visit release notes page of Aspose.PDF for .NET 18.4.

Determine Line Break

In particular scenarios of PDF generations, sometimes you may come up with a requirement to identify the points/positions where an Enter/Line Break was added to create new line or contents of a line were moved to subsequent line after content reaching to the edge of the page. We have implemented logging (tracking) background processing (line breaking) of multi-line text fragments in text adding scenarios. You can use GetNotifications(), a new method of Page Class in order to achieve the functionality. An example of such functionality has been provided in API documentation on following link:

Since we have already planned to improve the feature to support of such scenarios, we are working over adding the functionalities for editing existing PDF documents. We hope to provide more enhancements in API regarding this feature in upcoming versions. For now, only notifications about paragraph events in text adding scenarios are supported.

Clone TextFragments with Identical Formatting

One of the interesting enhancements in Aspose.PDF for .NET 18.4 is, you can clone a TextFragment with segments formatting identical to the original fragment. You can use TextFragment.Clone() method in order to achieve this. Following code snippet shows how you can implement this feature in your application:

Document doc = new Document();
Page page = doc.Pages.Add();
TextFragment text = new TextFragment("some text");
TextSegment segment = new TextSegment("some segment");
segment.TextState.FontSize = 40;
text.Segments.Add(segment);
text = text.Clone() as TextFragment;
page.Paragraphs.Add(text);
doc.Save(outFile);

Miscellaneous

As it is always recommended to use latest release of our API’s, so we suggest you to please download the latest release Aspose.PDF for .NET 18.4 and check following resources which will help you working with API:

Leave a comment

Posted inAspose.PDF Product Family, Asad Ali
 

Related Articles