生成PDF缩略图(开源/免费) [英] Generate a pdf thumbnail (open source/free)

查看:272
本文介绍了生成PDF缩略图(开源/免费)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

综观其他职位这个找不到一个适当的解决方案,满足我的需求。想只得到一个PDF文档的缩略图的第一页。这是要运行作为服务器应用程序,这样就不会想写出一个PDF文档文件,以再调用第三个应用程序读取PDF生成磁盘映像。

  DOC =新PDFdocument(some.pdf); 
页面= doc.page(1);
图像的图像= page.image;



感谢。


解决方案< 。/ DIV>

太莲发布的开源包装器Ghostscript的,听起来就像你想要做什么,是在C#



链接到源代码:<一HREF =https://github.com/mephraim/ghostscriptsharp> https://github.com/mephraim/ghostscriptsharp



链接到博客发帖: http://www.mattephraim.com/blog/ 2009/1月6日/一个简单的-C-包装换的ghostscript /



您可以对GeneratePageThumb方法简单调用生成缩略图(有开始和结束的页码或使用GeneratePageThumbs生成多个单独页面的缩略图,每一个页面是一个单独的输出文件),默认的文件格式为JPEG,但你可以改变它,和许多其他的选择,通过使用备用GenerateOutput方法调用,并指定选项,如文件格式,页面大小,等等...


Looking at other posts for this could not find an adequate solution that for my needs. Trying to just get the first page of a pdf document as a thumbnail. This is to be run as a server application so would not want to write out a pdf document to file to then call a third application that reads the pdf to generate the image on disk.

doc = new PDFdocument("some.pdf");
page = doc.page(1);
Image image = page.image;

Thanks.

解决方案

Matthew Ephraim released an open source wrapper for Ghostscript that sounds like it does what you want and is in C#.

Link to Source Code: https://github.com/mephraim/ghostscriptsharp

Link to Blog Posting: http://www.mattephraim.com/blog/2009/01/06/a-simple-c-wrapper-for-ghostscript/

You can make a simple call to the GeneratePageThumb method to generate a thumbnail (or use GeneratePageThumbs with a start and end page number to generate thumbnails for multiple seperate pages, with each page being a seperate output file), default file format is jpeg but you can change it, and many other options, by using the alternate GenerateOutput method call and specify options such as file format, page size, etc...

这篇关于生成PDF缩略图(开源/免费)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆