Click here to Skip to main content
15,912,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to open the pdf file in full with # and get the current page. It is necessary for the user to fully grow to the end of the PDF and after performing the actions.

Have fun at least something. Thank`s.

What I have tried:

I use default librarry (AcroPDFLib), but i don`t have access for current page.
Posted
Updated 2-May-18 23:35pm
Comments
Richard MacCutchan 3-May-18 4:08am    
How do you define "current page"?

1 solution

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

namespace PdfParser
{
    public static class PdfTextExtractor
    {
        public static string pdfText(string path)
        {
            PdfReader reader = new PdfReader(path);
            string text = string.Empty;
            for(int page = 1; page <= reader.NumberOfPages; page++)
            {
                text += PdfTextExtractor.GetTextFromPage(reader,page);
            }
            reader.Close();
            return text;
        }   
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900