SfPdfViewer - Text selection does not preserve the space between words

I am using SfPdfViewer control in MAUI (Android) app. I have configured TextSelectionChanged event handler, it gets invoked on text selection change, but e.SelectedText does not preserve the whitespaces between words, and everything comes as continuous string.

This seems to be a bug and makes this functionality not useful.

version - 29.1.33
I have attached a repro code.

Attachment: PdfTest_9e567617.zip

5 Replies

BS Bharathi Selvam Syncfusion Team April 2, 2025 06:31 PM UTC

Hi Optimilia

We were able to replicate the issue “the white space is missing in the selected text“. We are currently in the process of validating the issue and will provide more details once completed the validation.

Regards,

Bharathi S



BS Bharathi Selvam Syncfusion Team April 10, 2025 07:16 PM UTC

Hi Optimilia,


We have confirmed the issue “Issue with ExtractText Method Missing Whitespace in the Text lines in specific PDF” as a defect in our product and we will include the fix in weekly release on 29th, April 2025


Please use the below feedback link to track the status of the reported bug.

Issue in Extracting text line using TextLineCollection for specific PDF in ASP.NET Core | Feedback Portal 


Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”


Regards,

Bharathi S



BS Bharathi Selvam Syncfusion Team April 29, 2025 03:02 PM UTC

Hi Optimilia,

We have resolved the issue “Issue with ExtractText Method Missing Whitespace in the Text lines in specific PDF” and now the fix for the issue is available in our latest weekly NuGet 29.1.40.

Please find our latest Weekly NuGet:

https://www.nuget.org/packages/Syncfusion.Maui.PdfViewer/29.1.40

Root cause details:

The condition to add white space between two words is implemented by default, but it does not work correctly for all glyphs, so the white space is not added properly.

Please find the feedback link below:
Issue in Extracting text line using TextLineCollection for specific PDF in ASP.NET Core | Feedback Portal 

Regards,

Bharathi S



OP Optimilia July 7, 2025 03:24 PM UTC

I tried the latest available version of the nuget, the issue is still present. Is the fix not yet rolled out?



BS Bharathi Selvam Syncfusion Team July 8, 2025 11:31 AM UTC

Hi Optimilia,


We have tested the sample using the latest version (30.1.38). When selecting text in the provided PDF, the text is extracted along with the white spaces as expected. Please find the attached sample and a video demonstrating the steps we followed during our testing.

Please find the sample and video from the link below: 

https://drive.google.com/file/d/1KLIZx-epbcBBu4ze226kB4pllm3b-2PR/view?usp=sharing 

Could you kindly review the video and let us know if we missed anything while replicating the issue?

To help us investigate further, could you please provide the following details:

  • Are there any specific texts that are not being extracted with white space?
  • Does the issue occur with the attached sample?
  • Are you using .NET 8 or .NET 9?
  • Are there any exact steps we might have missed?
  • If possible, could you share a modified sample that reproduces the issue?

Looking forward to your feedback.

Regards,
Bharathi S


Loader.
Up arrow icon