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

Free Support Forum - aspose.com

Highlighting Text in PDF

Hi I want to highlight some specific words in a PDF document with some different background colors. I have the list of those words. Will you please tell me how I will proceed with aspose.pdf.kit on .NET C# platform.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

You can use CreateMarkup() method of PdfContentEditor class in Aspose.Pdf.Kit, to highlight the text in Pdf file. For related information on highlighting text and for sample code snippet, please refer to CreateMarkup.

i've done as per your instuction in the provious reply but the fuction CreateMarkup is not highlighting the word. ReplaceText is working except in some area in the footer of the document.


We apologize for your inconvenience. I have tested the issue and have been able to notice that CreateMarkup method is not working in Aspose.Pdf.Kit v3.1.0.0. I have logged it in our issue tracking system as PDFKITNET-5659. We will investigate the issue in detail and will keep you updated on the status of a correction.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

As a workaround you can use Aspose.Pdf.Kit v3.0.0.0 I have tested following code snippet and CreateMarkup is working fine with this version. The resultant Pdf is in attachment.

PdfContentEditor editor = new PdfContentEditor();
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(90, 757, 25, 15);
System.Drawing.Color clr = System.Drawing.Color.AntiqueWhite;
editor.CreateMarkup(rect, "Segment", 0, 1, clr);