从pdf中提取图像 [英] extract image from pdf
本文介绍了从pdf中提取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面给出的鳕鱼
public string pdfgenera()
{
// 提取宽度和高度超过200像素的所有图像
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
string pdfFile = @ d:\ApplicationForm_10.pdf跨度>;
string imageDir = Path.GetDirectoryName(pdfFile);
List< PdfFocus.PdfImage> pdfImages = null ;
f.OpenPdf(pdfFile);
if (f.PageCount > 0 )
{
// 指定仅提取图像宽度和高度
// 超过200px
f .ImageExtractionOptions.MinSize = new System.Drawing.Size( 200 , 200 跨度>);
pdfImages = f.ExtractImages();
// 显示所有提取的图像。
if (pdfImages!= null && pdfImages.Count > 0 )
{
for (< span class =code-keyword> int i = 0 ; i < pdfImages .Count; i ++)
{
string imageFile = Path.Combine(imageDir, String .Format( img {0} .png,i + 1 跨度>));
pdfImages [i] .Picture.Save(imageFile);
System.Diagnostics.Process.Start(imageFile);
}
}
}
返回 < span class =code-string>;
}
在abouve code pdfimages count中为'0'为什么
请帮帮我..
提前致谢
解决方案
您好,请参阅
https:// psycodedeveloper .wordpress.com / 2013/01/10 / how-to-extract-images-from-pdf-files-using-c-and-itextsharp / [ ^ ]
the cod eis given below
public string pdfgenera()
{
// Extract all images with width and height more than 200px
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
string pdfFile = @"D:\ApplicationForm_10.pdf";
string imageDir = Path.GetDirectoryName(pdfFile);
List<PdfFocus.PdfImage> pdfImages = null;
f.OpenPdf(pdfFile);
if (f.PageCount > 0)
{
// Specify to extract only images which have width and height
// more than 200px
f.ImageExtractionOptions.MinSize = new System.Drawing.Size(200, 200);
pdfImages = f.ExtractImages();
// Show all extracted images.
if (pdfImages != null && pdfImages.Count > 0)
{
for (int i = 0; i < pdfImages.Count; i++)
{
string imageFile = Path.Combine(imageDir, String.Format("img{0}.png", i + 1));
pdfImages[i].Picture.Save(imageFile);
System.Diagnostics.Process.Start(imageFile);
}
}
}
return "";
}
in the abouve code pdfimages count is '0' why
pls help me..
Thanks in advance
解决方案
Hi just refer it
https://psycodedeveloper.wordpress.com/2013/01/10/how-to-extract-images-from-pdf-files-using-c-and-itextsharp/[^]
这篇关于从pdf中提取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文