We are pleased to announce a new release Aspose.PDF for .NET 17.3.0. This month’s release includes a new feature to calculate Table width and embed media files(audio and video) in PDF document along with some other important features. We have also enhanced the Footnote feature and HTML text support in this version in addition to many other bug fixes reported in old releases that improve the APIs functionality. Please check the detailed release notes of this version to get an idea about the new features/enhancements and fixes made in this release.

Furthermore, If you are planning to upgrade the API from any previous version, we strongly recommend you to check the Public API Changes section of other intermediate releases from release notes folder, to know what has been changed since your current revision of the API.

The following sections describe some details regarding these newly added enhancements.

Embed Media files in PDF Document

We have implemented a new annotation RichMediaAnnotation in Aspose.PDF for .NET 17.3.0. It is used to embed media files within PDF documents. In fact, RichMediaAnnotation is the container for the SWF (Flash) script. Due to license restriction, we cannot include third-party flash scripts in our product, so you should provide your own script for playing video or audio. For example, you can use VideoPlayer and AudioPlayer shipped with Adobe Acrobat. Please check the documentation link for sample code and details to embed video/audio files in PDF document using RichMediaAnnotation.

Calculate Table Width

In some scenarios, you have not hardcoded the Table width in PDF document and later you want to know its width for some post-processing. We have introduced a new method GetWidth() to calculate Table width in this release. It renders the table and gets its width as follows:

Aspose.Pdf.Table table = new Aspose.Pdf.Table();
table.ColumnAdjustment = ColumnAdjustment.AutoFitToContent;
Aspose.Pdf.Row row = table.Rows.Add();
Aspose.Pdf.Cell cell1 = row.Cells.Add("Cell 1");
Aspose.Pdf.Cell cell2 = row.Cells.Add("Cell 2 text");
// get Table width
Console.WriteLine(table.GetWidth());
// get cell width
Console.WriteLine(cell1.Width);

HTML Text Formatting

Aspose.PDF supports the insertion of HTML string in PDF document. If HTML specified fonts are available on the host system then it uses the same fonts, otherwise, it uses system default fonts for HTML string. We have received some requirements to support font overriding feature for HTML string. We have implemented TextState object in HtmlFramgent class, now you can override font details of HTML string as follows:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
Page page = doc.Pages.Add();
HtmlFragment html = new HtmlFragment("some text");
html.TextState = new TextState();
html.TextState.Font = FontRepository.FindFont("Calibri");
page.Paragraphs.Add(html);
doc.Save(myDir+"test.pdf");

FootNote Color

In the current release, we have also added support to set the color of the FootNote label(node identifier). We have implemented a TextState object in the FootNote class. You can set FootNote label color using TextState as following:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
Page page = doc.Pages.Add();
Aspose.Pdf.GraphInfo graph = new Aspose.Pdf.GraphInfo();
graph.LineWidth = 2;
graph.Color = Aspose.Pdf.Color.Red;
graph.DashArray = new int[] { 3 };
graph.DashPhase = 1;
page.NoteLineStyle = graph;
TextFragment text = new TextFragment("test text 1");
text.FootNote = new Note("foot note for test text 1");
text.FootNote.Text = "21";
text.FootNote.TextState = new TextState();
text.FootNote.TextState.ForegroundColor = Aspose.Pdf.Color.Blue;
text.FootNote.TextState.FontStyle = FontStyles.Italic;
page.Paragraphs.Add(text);
doc.Save(myDir + "footnote.pdf");

Aspose.Pdf for .NET Resources

The following resources will help you work with Aspose.PDF for .NET: