We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Yellow highlighting in PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

127884 Dec 15,2016 12:43 PM UTC Dec 19,2016 11:35 AM UTC ASP.NET Web Forms 3
loading
Tags: PDF
Jan Bednar
Asked On December 15, 2016 12:43 PM UTC

Dear Syncfusion,
is it possible to make a yellow highligthing like shown in example? I have just blank PDF and I want to highlight some specific text or paragraph.

Thank you for your help.

Best regards,
Jan Bednar

Attachment: cut_cdc0ad45.zip

Praveenkumar H [Syncfusion]
Replied On December 16, 2016 11:51 AM UTC

Hi Jan, 
Thank you for using Syncfusion products. 
You can highlight the particular text or paragraph by using PdfTextMarkupAnnotation with text bounds.  
Please find the code snippet to highlight the particular text, 
RectangleF rect = new RectangleF(55, 100, 280, 20); 
PdfTextMarkupAnnotation textannot = new PdfTextMarkupAnnotation(rect); 
textannot.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight; 
textannot.TextMarkupColor = new PdfColor(Color.Yellow); 
page.Annotations.Add(textannot); 
 
Please let us know if you have any concerns. 
With Regards, 
Praveen 


Jan Bednar
Replied On December 16, 2016 02:29 PM UTC

Dear Syncfusion,
thank you for your update. Is it possible to extract the text from PDF and then highlight the chosen one?

Thank you,
Jan Bednar

Gayathri Ramalingam [Syncfusion]
Replied On December 19, 2016 11:35 AM UTC

Hi Jan, 
Thank you for your update. 
You can extract the text from PdfLoadedDocument by using ExtractText().  
Please find the code snippet to Extract the text form Loaded document, 
PdfLoadedDocument lDoc = new PdfLoadedDocument(@"Input.pdf");            
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage; 
string text= page.ExtractText(); 
 
And you can highlight the chosen text or paragraph by using PdfTextMarkupAnnotation with text bounds.  
You can get the bounds value of the selected text by using below code, 
lDoc.FindText(text, out rectCollection); 
 
We have created a sample to highlight the text in Windows Forms. Please find the sample from the below link, 
Sample link: 
 
Please let us know if you have any concerns. 
 
With Regards, 
Gayathri R 
 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;