<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0050)http://www.codeproject.com/KB/string/pdf2text.aspx -->
<HTML><HEAD><TITLE>CodeProject: Converting PDF to Text in C#. Free source code and programming help</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META
content="Parsing PDF files in .NET using PDFBox and IKVM.NET (managed code).; Author: Dan Letecky; Section: String handling; Chapter: General Programming"
name=Description>
<META
content="C#, Windows, .NET, Visual Studio, Dev, Intermediate,String handling,General Programming,Free source code, tutorials"
name=Keywords>
<META content="The Code Project" name=Author>
<META content=General name=Rating>
<META content="index, follow" name=Robots>
<META content="1 days" name=Revisit-After><LINK
title="CodeProject Latest articles - All topics"
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=1"
type=application/rss+xml rel=alternate><LINK
title="CodeProject Latest articles - MFC / C++"
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=2"
type=application/rss+xml rel=alternate><LINK
title="CodeProject Latest articles - C#"
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=3"
type=application/rss+xml rel=alternate><LINK
title="CodeProject Latest articles - ASP.NET"
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=4"
type=application/rss+xml rel=alternate><LINK
title="CodeProject Latest articles - .NET"
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=5"
type=application/rss+xml rel=alternate><LINK
title="CodeProject Latest articles - VB.NET"
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=6"
type=application/rss+xml rel=alternate><LINK title="CodeProject Lounge Postings"
href="http://www.codeproject.com/webservices/LoungeRSS.aspx"
type=application/rss+xml rel=alternate><LINK title=CodeProject
href="http://www.codeproject.com/info/OpenSearch.xml"
type=application/opensearchdescription+xml rel=search><LINK
href="CodeProject Converting PDF to Text in C#_ Free source code and programming help.files/CodeProject.css"
type=text/css rel=stylesheet><LINK
href="CodeProject Converting PDF to Text in C#_ Free source code and programming help.files/ForumClassic.css"
type=text/css rel=stylesheet>
<SCRIPT type=text/javascript>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</SCRIPT>
<SCRIPT type=text/javascript>
var pageTracker = _gat._getTracker("UA-1735123-1");
pageTracker._setDomainName("www.codeproject.com");
pageTracker._setSessionTimeout("1200"); // 20 mins
pageTracker._initData();
pageTracker._trackPageview();
</SCRIPT>
<SCRIPT language=Javascript
src="CodeProject Converting PDF to Text in C#_ Free source code and programming help.files/oncopy.js"
type=text/javascript></SCRIPT>
<SCRIPT language=Javascript
src="CodeProject Converting PDF to Text in C#_ Free source code and programming help.files/jxs.js"
type=text/javascript></SCRIPT>
<SCRIPT language=Javascript
src="CodeProject Converting PDF to Text in C#_ Free source code and programming help.files/bookmark.js"
type=text/javascript></SCRIPT>
<SCRIPT language=Javascript
src="CodeProject Converting PDF to Text in C#_ Free source code and programming help.files/rateitem.js"
type=text/javascript></SCRIPT>
<SCRIPT language=Javascript type=text/javascript>//<![CDATA[
function ToggleMenu(itemName)
{
var elm = document.getElementById(itemName);
var i,others = document.getElementById('SectionMenu');
for(i=0; i < others.childNodes.length; i++)
{
var other = others.childNodes[i];
if ((other.className == 'MenuSectionBlock') && (other != elm))
other.style.display='none';
}
if (elm.style.display == 'block') elm.style.display='none';
else elm.style.display='block';
return false;
}
//]]></SCRIPT>
<SCRIPT language=Javascript
src="CodeProject Converting PDF to Text in C#_ Free source code and programming help.files/addto.js"
type=text/javascript></SCRIPT>
<SCRIPT language=Javascript type=text/javascript>//<![CDATA[
function MarkAns(MemberID,MsgID,QID) {
document.write(unescape("%3Cdiv class=\"CallOut\"%3E"));
document.write("Was this a good answer to your question? ");
document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" "));
document.write("onclick=\"RateMsg("+MemberID.toString()+", "+MsgID.toString()+",6,"+QID.toString()+");\"");
document.write(unescape("%3E"));
document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/good.png\" alt=\"correct\" border=\"0\" align=\"absmiddle\" /%3E Yes%3C/a%3E"));
document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" "));
document.write("onclick=\"RateMsg("+MemberID.toString()+","+MsgID.toString()+",7,"+QID.toString()+");\"");
document.write(unescape("%3E"));
document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/bad.png\" alt=\"correct\" style=\"margin-left:10px\" border=\"0\" align=\"absmiddle\" /%3E No%3C/a%3E"));
document.write(unescape("%3C/div%3E"));
}
function MsgVFrm(MemberID,MsgID,GB,gp,bp,mt){
if(!GB)document.write("Rate this message: ");
document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"5":"1")+unescape(",0);\"%3E"));
if(GB) document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/good.png\" alt=\"good\" border=\"0\" align=\"absmiddle\" /%3E "+gp+" "+mt+"%3C/a%3E "));
else document.write(unescape("%3Cimg height=\"14\" width=\"14\" src=\"/script/Forums/Images/thumbs_down.gif\" alt=\"vote 1\" border=\"0\" align=\"middle\" /%3E%3C/a%3E "));
if(GB)document.write(" "); else for(var i=1; i<=5;i++)
document.write(unescape("%3Ca class=\"Frm_MHL\" href=\"#xx" + MsgID.toString() + "xx\" title=\"vote this message a " + i.toString() + "\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ", " + i.toString() + ",0)\"%3E%3Cb%3E" + i.toString() + "%3C/b%3E%3C/a%3E "));
document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"1":"5")+unescape(",0);\"%3E"));
if(GB)document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/bad.png\" alt=\"bad\" border=\"0\" align=\"absmiddle\" /%3E "+bp+" "+mt+"%3C/a%3E"));
else document.write(unescape("%3Cimg height=\"14\" width=\"14\" src=\"/script/Forums/Images/thumbs_up.gif\" border=\"0\" alt=\"vote 5\" align=\"middle\" /%3E%3C/a%3E "));
}
function ReportMsg(userid, msgid, score) {
if (confirm("Are you sure you want to report this message?"))
return RateMsg(userid, msgid, score, 0);
else return false;
}
function RateMsg(memberid, msgid, score, questionId) {
var req = new ActiveXObject("MSXML2.XMLHTTP");
req.onreadystatechange = function() {
if (req.readyState == 4){
if (req.status == 200){
var respText = req.responseText;
var re = new RegExp(unescape("\%3Cdiv\%3E([^\%3C]*)\%3C/div\%3E"), "g");
var match = re.exec(respText);
voteStatus.innerHTML = unescape("%3Cb%3E") + (match&&match[1])?match[1]:"An error occured" + unescape("%3C/b%3E");
} else
voteStatus.innerHTML = unescape("%3Cb style='color:red'%3EFailed!") + req.statusText + unescape("%3C/b%3E");
}
}
var voteStatus = document.getElementById("MVF" + msgid);
if (!voteStatus) return;
voteStatus.innerHTML = unescape("%3Cb style='color:green'%3EVoting...%3C/b%3E");
var strAction = "/script/Forums/Vote.aspx?js=1&fmid="+memberid.toString()+"&select="+msgid.toString()+"&score="+score.toString()+"&qid="+questionI
评论4