Hi,
I'm trying to extract text from this PDF File line by line using linecollection properties. but its showing this error- FormatException: String must be exactly one character long. But if try extracting text using layout base then its ok.
Another issue, how could I read a table inside the pdf file as it is? plss see the below picture in PDF file
Here is my sample code.
foreach (PdfPageBase page in loadedDocument.Pages)
{
TextLineCollection lineCollection = new TextLineCollection();
page.ExtractText(out lineCollection);
foreach (TextLine line in lineCollection.TextLine)
{
foreach (TextWord word in line.WordCollection)
{
if (word.Text != " ")
{
extractedText = extractedText + word.Text.Trim() + " ";
}
}
extractedText += Environment.NewLine;
}
extractedText += Environment.NewLine + Environment.NewLine + Environment.NewLine;
extractedText += "===========================================================";
extractedText += Environment.NewLine + Environment.NewLine + Environment.NewLine;
}
Thanking in advance for your help
Query |
Details |
I'm trying to extract text from this PDF File line by line using linecollection properties. but its showing this error- FormatException: String must be exactly one character long. But if try extracting text using layout base then its ok.
|
We were able to reproduce the reported issue “Exception throws while extracting text” from the provided document. We will analyze further on this and update you with more details on August 11, 2021.
|
Another issue, how could I read a table inside the pdf file as it is? plss see the below picture in PDF file
|
Our Syncfusion PDF Viewer control will be extracting the text from PDF documents based on the structure of content present in the PDF document. So, based on that we cannot recognize the rows and columns present in the table of the PDF document. Also, it is not possible to extract the text in the correct order as it is in the PDF document. Sorry for the inconvenience.
|
Query |
Details | |
I'm trying to extract text from this PDF File line by line using linecollection properties. but its showing this error- FormatException: String must be exactly one character long. But if try extracting text using layout base then its ok.
|
We can resolve the reported issue using PdfRenderer class instead of using PdfLoadedDocument. Please refer to the below code snippet.
Code Snippet.
However, we have confirmed that the reported issue “Exception throws while extracting text using PdfLoadedDocument” is a defect and the fix will be included in our upcoming weekly release on August 31, 2021.
You can track the status using below feedback link.
|
Thanks for your reply..
Blazor Client |
|
Blazor Sever |
|
Service side package |
ASP.NET Core :
https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows/ https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux/
ASP.NET MVC:
|