admin管理员组文章数量:1316532
I have tried this
string text = "";
using (PdfReader pdfReader = new PdfReader(dlg.FileName))
{
for (int page = 1; page <= pdfReader.NumberOfPages; page++)
{
text = PdfTextExtractor.GetTextFromPage(pdfReader, page);
}
}
text = text.Replace("\n", "\r\n");
which gave me this result
"AI(240)10575323190069
AI(13)240215
24-02-15 (YY-MM-DD)
PI-734875-1
19006
© Inter IKEA Systems
B.V. 2021
105.753.23
Made in Pakistan"
it just misses "2407"
that is written in most right side of the PDF, as seen below. Is there a way that I can read that from my PDF?
I am expecting to read rotated text on the right side of the document along with all.
This is the content of my PDF file:
I have tried this
string text = "";
using (PdfReader pdfReader = new PdfReader(dlg.FileName))
{
for (int page = 1; page <= pdfReader.NumberOfPages; page++)
{
text = PdfTextExtractor.GetTextFromPage(pdfReader, page);
}
}
text = text.Replace("\n", "\r\n");
which gave me this result
"AI(240)10575323190069
AI(13)240215
24-02-15 (YY-MM-DD)
PI-734875-1
19006
© Inter IKEA Systems
B.V. 2021
105.753.23
Made in Pakistan"
it just misses "2407"
that is written in most right side of the PDF, as seen below. Is there a way that I can read that from my PDF?
I am expecting to read rotated text on the right side of the document along with all.
This is the content of my PDF file:
Share Improve this question edited Jan 30 at 9:29 DarkBee 15.6k8 gold badges72 silver badges117 bronze badges asked Jan 30 at 9:24 SYED RASHIDSYED RASHID 112 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0OCR is often problematic especially for numbers so if you have 95 % correct it is good and then you only need to correct or add the last 5%.
Avoid OCR for numbers as often they will be missing or incorrect, and the large 105.753.23
is often not recognised in a page of other text.
Here I used the online Demo of SautinSoft and can get that 2407 but for every other image it may not be the case. OCR is never "Guaranteed" nor should be.
You can get the same (or better quality) simply by asking tesseract to generate both text and PDF at the same time like here.
Note again that both the 105.753.23
and 19006
have been misread as MAA ATT.
本文标签: cHow to read rotated textStack Overflow
版权声明:本文标题:c# - How to read rotated text? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741976436a2408153.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
M
a
d
e
` `i
n
etc were next to each other (in the file, not the printed page) and so were treated as consecutive text. Libraries have to guess whether the positioning and rendering instructions they find are text or not. – Panagiotis Kanavos Commented Jan 30 at 9:2819006
and105.754.23
weren't extracted either. It may not be possible to extract them (or the "rotated" text) or you may have to use a different TextExtractionStrategy – Panagiotis Kanavos Commented Jan 30 at 9:35but an image.
you can't read it as text then. You'll have to use an OCR library. Which, by the way, is quite often the best option with PDFs. iText does that with its pdfOCR product, which uses the Tesseract library underneath. – Panagiotis Kanavos Commented Jan 30 at 9:38