如何使用C#读取pdf文件中的电话号码并保存到SQL数据库中 [英] How to read phone number in pdf file using C# and save into SQL database

查看:164
本文介绍了如何使用C#读取pdf文件中的电话号码并保存到SQL数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从pdf文件中读取字段并保存到sql数据库中。



我尝试过:



 StringBuilder text =  new  StringBuilder(); 
使用(PdfReader reader = new PdfReader( @ C:\\INetCache \Content.Outlook\00096.pdf))
{
< span class =code-keyword> for ( int i = 1 ; i < span class =code-keyword>< = reader.NumberOfPages; i ++)
{
text.Append(PdfTextExtractor.GetTextFromPage(reader,i));
}
}

解决方案

你不说你的问题是什么(我假设你的'没有文字'文本StringBuilder对象)或者你正在使用的是什么版本的iTextSharp ..



这看起来像是一个'更新'的方式,至少,博客条目更多'recent'... 使用iTextSharp从C#中的PDF中读取文本| Chris Schiffhauer [ ^ ]

I want to read field from pdf file and save into sql database.

What I have tried:

StringBuilder text = new StringBuilder();
            using (PdfReader reader = new PdfReader(@"C:\\INetCache\Content.Outlook\00096.pdf"))
            {
                for (int i = 1; i <= reader.NumberOfPages; i++)
                {
                    text.Append(PdfTextExtractor.GetTextFromPage(reader, i));
                }
            }

解决方案

you dont say what your issue is (I presume 'no text' in your text StringBuilder object) or what version of iTextSharp you're using ..

this looks like a 'newer' way doing it, at least, the blog entry is more 'recent' ... Read Text from a PDF in C# with iTextSharp | Chris Schiffhauer[^]


这篇关于如何使用C#读取pdf文件中的电话号码并保存到SQL数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆