10

我想从 PDF 中提取图像。尝试了许多解决方案,但仍然没有得到解决方案。帮帮我....提前谢谢

4

1 回答 1

2

Docotic.Pdf 库可用于从 PDF 中提取图像。

以下示例展示了如何从 PDF 中提取所有图像:

static void ExtractAllImages()
{
    string path = "";
    using (PdfDocument pdf = new PdfDocument(path))
    {
        for (int i = 0; i < pdf.Images.Count; i++)
        {
            string imageName = string.Format("image{0}", i);
            string imagePath = pdf.Images[i].Save(imageName);
        }
    }
}

该库不会重新采样图像。它将以与 PDF 完全相同的方式保存它们。

免责声明:我为图书馆供应商 Bit Miracle 工作。

于 2011-09-08T18:07:49.580 回答