Question: In my windows 8 application, I would like to read a PDF line by line then I would like to assign a String array. How can I do it?

```
    public StringBuilder addd= new StringBuilder();
    string[] array;

    private async void btndosyasec_Click(object sender, RoutedEventArgs e)
    {
        FileOpenPicker openPicker = new FileOpenPicker();
        openPicker.ViewMode = PickerViewMode.List;
        openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
        openPicker.FileTypeFilter.Add(".pdf");

        StorageFile file = await openPicker.PickSingleFileAsync();

        if (file != null)
        {

            PdfReader reader = new PdfReader((await file.OpenReadAsync()).AsStream());

            for (int page = 1; page <= reader.NumberOfPages; page++)
            {

                addd.Append(PdfTextExtractor.GetTextFromPage(reader, page));
                string tmp= PdfTextExtractor.GetTextFromPage(reader, page);

                array[page] = tmp.ToString();

                reader.Close();
            }
        }
    }

```

Answer: 
Hi I had this problem too, I used this code, it worked.

You will need a reference to the iTextSharp lib.

```
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;

PdfReader reader = new PdfReader(@"D:\test pdf\Blood Journal.pdf");
int intPageNum = reader.NumberOfPages;
string[] words;
string line;

    for (int i = 1; i <= intPageNum; i++)
    {
        text = PdfTextExtractor.GetTextFromPage(reader, i, new LocationTextExtractionStrategy());

        words = text.Split('\n');
        for (int j = 0, len = words.Length; j < len; j++)
        {
            line = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(words[j]));
        }
    }

```

words array contains lines of pdf file
If you are looking for something **Licence Free/Open Source** with basic text extraction from PDF, then you can go for **PdfClown** which has Support for both .Net Framework as well as .NET CORE (though Beta version w.r.t .NET Standard 2.0). For More Info or Samples, take look at 

<https://www.nuget.org/packages/PdfClown.NetStandard/0.2.0-beta>

<https://sourceforge.net/p/clown/code/HEAD/tree/trunk/dotNET/pdfclown.samples.cli/>

Below sample is w.r.t .NET CORE.

```
public class PdfClownUtil
{
    private static readonly string fileSrcPath = "MyTestDoc.pdf";
    private readonly StringBuilder stringBuilder_1 = new StringBuilder();
    public string GetPdfTextContent()
    {
        PdfDocuments.Document document = new File(fileSrcPath).Document;
        StringBuilder stringBuilder_2 = new StringBuilder();

        TextExtractor extractor = new TextExtractor();
        foreach (Page page in document.Pages)
        {
            // Approach-1: 
            Extract(new ContentScanner(page));

            // Approach-2 with additional Options: 
            IList<ITextString> textStrings = extractor.Extract(page)[TextExtractor.DefaultArea];
            foreach (ITextString textString in textStrings)
            {
                stringBuilder_2.Append(textString.Text);
            }
            stringBuilder_2.AppendLine();
        }
        var content = stringBuilder_2.ToString();
        return content;
    }

    // Approach-1: 
    private void Extract(ContentScanner level)
    {
        if (level == null)
        {
            return;
        }                

        while (level.MoveNext())
        {
            ContentObject content = level.Current;
            if (content is ShowText)
            {
                Font font = level.State.Font;
                // Extract the current text chunk, decoding it!
                this.stringBuilder_1.Append(font.Decode(((ShowText)content).Text));
            }
            else if (content is Text || content is ContainerObject)
            {
                // Scan the inner level!
                Extract(level.ChildLevel);
            }
        }
    }
}

```