Welcome to the ASP.NET Core feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET Core, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
FileStream inputDocument = new FileStream(filePath, FileMode.Open);
PdfLoadedDocument loadedDocument = null;
StringBuilder sb = new StringBuilder();
try
{
loadedDocument = new PdfLoadedDocument(inputDocument);
for (int pageIndex = startPageIndex - 1; pageIndex <= endPageIndex; pageIndex++)
{
sb.Append(loadedDocument.Pages[pageIndex].ExtractText(true));
}
loadedDocument.Close(true);
}
catch (Exception exc)
{
this.logger.LogError(exc.Message);
return string.Empty;
}
return sb.ToString();
It puts spaces where there should be no spaces when converting PDF to text. It also connects the places where there should be spaces.
This is the part of pdf:

This is the result text:
