栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何将pdf文件转换为图像

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何将pdf文件转换为图像

以下线程适合您的要求。
将pdf文件转换为jpeg图像

一种解决方案是使用第三方库。ImageMagick非常受欢迎,也可以免费获得。您可以在这里获得.NET包装器。原始的ImageMagick下载页面在这里。

  • http://www.preproject.com/KB/library/pdftoimages.aspx使用Solid framework将PDF页面转换为图像文件(无效链接,已删除的文档可从Internet存档上获得)。
  • http://www.print-driver.com/howto/convert_pdf_to_jpeg.html通用文档转换器
  • http://www.makeuseof.com/tag/6-ways-to-convert-a-pdf-file-to-a-jpg-image/ 6种将PDF转换为JPG图像的方法

您还可以看一下该线程:
如何在C#中通过pictureBox中的pdf文件打开页面

如果使用此过程将PDF转换为tiff,则可以使用此类从tiff检索位图。

public class TiffImage{    private string myPath;    private Guid myGuid;    private frameDimension myDimension;    public ArrayList myImages = new ArrayList();    private int myPageCount;    private Bitmap myBMP;    public TiffImage(string path)    {        MemoryStream ms;        Image myImage;        myPath = path;        FileStream fs = new FileStream(myPath, FileMode.Open);        myImage = Image.FromStream(fs);        myGuid = myImage.frameDimensionsList[0];        myDimension = new frameDimension(myGuid);        myPageCount = myImage.GetframeCount(myDimension);        for (int i = 0; i < myPageCount; i++)        { ms = new MemoryStream(); myImage.SelectActiveframe(myDimension, i); myImage.Save(ms, ImageFormat.Bmp); myBMP = new Bitmap(ms); myImages.Add(myBMP); ms.Close();        }        fs.Close();    }}

像这样使用它:

private void button1_Click(object sender, EventArgs e){    TiffImage myTiff = new TiffImage("D:\Some.tif");    //imageBox is a PictureBox control, and the [] operators pass back    //the Bitmap stored at that position in the myImages ArrayList in the TiffImage    this.pictureBox1.Image = (Bitmap)myTiff.myImages[0];    this.pictureBox2.Image = (Bitmap)myTiff.myImages[1];    this.pictureBox3.Image = (Bitmap)myTiff.myImages[2];}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/568429.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号