Hello guys,
I have got a scenarion where i want to read text from PDF including tables.
With itextsharp i am doing this but for few PDF its not working at all.
Suppose, if my PDF contains paragraphs on my 1st page and table on second page then its reading but when my PDF contains table on 1st page itself then its not reading.
I tried this below link :
https://bytescout.com/products/developer/pdfextractorsdk/how-to-extract-text-from-pdf-to-filestream-using-pdf-extractor-sdk-in-csharp
but still i am unable to extract text fully from my PDF i am interested in extracting text from PDF.
Please find my code below.
Is there any 3rd part dll ???
As far as i have searched there is no provision to read table from PDF.
Please suggest guys.
Thanks
Tony ChenPosted Nov 16, 2018, 9:54 PM
Mohamed AbedallahPosted Jan 25, 2018, 11:04 AM
https://www.leadtools.com/help/leadtools/v19/dh/l/rasterexceptioncode.html
If you still can't solve the problem, LEADTOOLS has free email support, so try to send full details about the problem to [email protected]
PustingPosted Jan 18, 2018, 5:21 AM
Ashwanikumar singhPosted Jan 18, 2018, 12:08 AM
{
// string path = @"C:\Users\product\Downloads\AIRLINE INVOICES\Can't Read\TN-10419-17-18.pdf";
StringBuilder sb;
sb = new StringBuilder();
PDFDocument document = new PDFDocument(@"C:\Users\product\Downloads\AIRLINE INVOICES\Can't Read\TN-10419-17-18.pdf"); //here i am getting exception
PDFParsePagesOptions options = PDFParsePagesOptions.Objects;
document.ParsePages(options, 1, -1);
foreach (PDFDocumentPage page in document.Pages)
{
Console.WriteLine("Page #" + page.PageNumber.ToString() + " Started");
foreach (PDFObject obj in page.Objects)
{
if (obj.ObjectType == PDFObjectType.Text)
{
if (obj.TextProperties.IsEndOfLine)
sb.AppendLine(obj.Code.ToString());
else
sb.Append(obj.Code);
}
}
Console.WriteLine("Page #" + page.PageNumber.ToString() + " finished");
}
return sb.ToString();
}
Leon DPosted Jan 17, 2018, 8:22 PM
Mohamed AbedallahPosted Jan 17, 2018, 11:30 AM
If you still cannot get the text from table, this may indicate that text in table is an image based and not actual text. If this is the case, you can use the OCR functions of LEADTOOLS to recognize the whole pages of the PDF then get the recognized text. The following code shows how you can do that:
Srikant MaruwadaPosted Jan 17, 2018, 12:55 AM