Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in converting scanned pdf to image #10

Open
prasanthtp opened this issue Mar 13, 2019 · 1 comment
Open

Issue in converting scanned pdf to image #10

prasanthtp opened this issue Mar 13, 2019 · 1 comment

Comments

@prasanthtp
Copy link

I was trying to convert the attached pdf to an image using page.GetImages() function as described in the example. It is not working.
44.pdf

@prasanthtp
Copy link
Author

` static void Main(string[] args)
{

        string filename = @"C:\Temp\44.pdf";
        Console.WriteLine("Processing file: {0}", filename);
        using (PdfDocument document = PdfReader.Open(filename, PdfDocumentOpenMode.Import))
        {
            int pageIndex = 0;
            foreach (PdfPage page in document.Pages)
            {
                int imageIndex = 0;
                foreach (Image image in page.GetImages())
                {
                   
                    Console.WriteLine("\r\nExtracting image {1} from page {0}", pageIndex + 1, imageIndex + 1);

                    // Save the file images to disk in the current directory.
                    image.Save(String.Format(@"C:\Temp\{0:00000000}-{1:000}.png", pageIndex + 1, imageIndex + 1, Path.GetFileName(filename)), ImageFormat.Png);
                    imageIndex++;
                }
                pageIndex++;
            }

        }
    }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant