Quantcast
Channel: Nayyer Shahbaz – Blog – Aspose.com
Viewing all articles
Browse latest Browse all 129

Strikeout Text, addition of HTML to existing PDF, determine PDF/A file and an optimized inter file format conversion with Aspose.Pdf for .NET 10.7.0

$
0
0

aspose Pdf for net 100 Strikeout Text, addition of HTML to existing PDF, determine PDF/A file and an optimized inter file format conversion with Aspose.Pdf for .NET 10.7.0A new release of Aspose.Pdf for .NET 10.7.0 has been published with new features and enhancements which were requested in earlier release versions. Likewise previous versions, this new release also contains fixes for issues reported against previous releases. Following are some details regarding features introduced in this new release.

Strikeout feature in TextState class

The TextState class provides the capabilities to set formatting for TextFragments being placed inside PDF document. You can use this class to set text formatting as Bold, Italic, Underline and starting this release, the API has provided the capabilities to mark text formatting as Strikeout. Please try using following code snippet to add TextFragment with Strikeout formatting.

//open document
Document pdfDocument = new Document();
//get particular page
Page pdfPage = (Page)pdfDocument.Pages.Add();

//create text fragment
TextFragment textFragment = new TextFragment("main text");
textFragment.Position = new Position(100, 600);

//set text properties
textFragment.TextState.FontSize = 12;
textFragment.TextState.Font = FontRepository.FindFont("TimesNewRoman");
textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.LightGray;
textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.Red;
//set StrikeOut property
textFragment.TextState.StrikeOut = true;
// mark text as Bold
textFragment.TextState.FontStyle = FontStyles.Bold;

// create TextBuilder object
TextBuilder textBuilder = new TextBuilder(pdfPage);
// append the text fragment to the PDF page
textBuilder.AppendText(textFragment);
//save document
pdfDocument.Save(outFile);

Add HTML contents to existing PDF document

Aspose.Pdf for .NET provides the capabilities to Convert HTML to PDF Format, as well as the feature to Add Text in an Existing PDF File. However with this release, we have also introduced the feature to add HTML contents inside PDF document where HTML tags will be rendered accordingly, instead they appear as static HTML tags.

//open document
Document pdfDocument = new Document();
string outFile = "33851.pdf";
// create HTML Fragment object to speicfy the HTML contents which need to be added
HtmlFragment t = new HtmlFragment(" < body style='line-height: 100px;'>First line of text
Second Line of Text
  • First
  • Second
  • Third
  • Fourth
  • Fifth
Text after the list.Next line
Last line

Viewing all articles
Browse latest Browse all 129

Trending Articles