Convert hyperliks from a pdf document to a word document ?
HIam facing a problem is am try try to convert a pdf document to aword document. it working fine, but if a pdf document having a hyperlink it dosent convert into a hyperlink format it is convert simply text format please help me fast...
below is my code.
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
string filepath;
dlg.Filter = "PDF Files(*.PDF)|*.PDF|All Files (*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
filepath = dlg.FileName.ToString();
string strtext = string.Empty;
try
{
PdfReader reader = new PdfReader(filepath);
for (int page = 1; page <= reader.NumberOfPages; page++)
{
//PdfDictionary PageDictionary = reader.GetPageN(page);
//PdfArray Annots = PageDictionary.GetAsArray(PdfName.ANNOTS);
////var Links =Annots
ITextExtractionStrategy its = new iTextSharp.text.pdf.parser.LocationTextExtractionStrategy();
string s = PdfTextExtractor.GetTextFromPage(reader, page, its);
s = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(s)));
//if(Annots!=null)
strtext = strtext + s;
richTextBox1.Text = strtext;
}
reader.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
StreamWriter File = new StreamWriter("E://testing//" + dlg.SafeFileName + DateTime.Now.Millisecond + ".doc" + "");
File.Write(richTextBox1.Text);
File.Close();
}
Thanks in advance,