Hello friends and experts,
I have question
I would like to make and application .The application would can be import text file, excel file . Actually I would like to import the PDF file too. But I don't know how to do . I can say I don't know C# can able be import the PDF file or not.
So I have question like below
1. Can the Visual C# be able import the PDF file directly ? If possible . Please advice me for how to do that ?
2. Another way , If I would like to extract the data from PDF file to Excel file .Then I can be import the excel file instead.
Could it be possible to extract data from PDF file to Excel file ? Please advice me .
FoonMod
Loading
Posted May 26, 2011, 1:52 AM
You can use the iTextSharp library to read the data from PDF file and it is free.
before doing do need think what kind of data will be there in the PDF file.
1) Does it will contain only text data?
2) Does it will contain images?
3) Does it will tables and border.
If that how you are going manage the data.
using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace PdfProperties
{
class Program
{
static void Main(string[] args)
{
// create a reader (constructor overloaded for path to local file or URL)
PdfReader reader
= new PdfReader("your pdf here");
// total number of pages
int n = reader.NumberOfPages;
// size of the first page
Rectangle psize = reader.GetPageSize(1);
float width = psize.Width;
float height = psize.Height;
Console.WriteLine("Size of page 1 of {0} => {1} × {2}", n, width, height);
// file properties
Dictionary
foreach (KeyValuePair
Console.WriteLine(kvp.Key + " => " + kvp.Value);
}
}
}
Once you read the data you can conver itto excel also.
http://jadn.co.uk/w/ReadPdfUsingCsharp.htm
http://www.melbtest.com.au/woa/pdf-excel_download.htm
http://www.codeproject.com/KB/showcase/TallComponents.aspx
http://studentclub.ro/lucians_weblog/archive/2011/05/19/14851.aspx
http://www.codeproject.com/KB/string/pdf2text.aspx
Hope this helps you.
natchaya khamkunaPosted May 26, 2011, 2:34 AM