在C#中导出PDF格式为JPG(S) [英] Export PDF to JPG(s) in C#

查看:463
本文介绍了在C#中导出PDF格式为JPG(S)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个一个页面的PDF文档保存为图像在网站上的缩略图。

I need to save a one page pdf document as an image for a thumbnail on a website.

我一直插科打诨与PDFSharp和有没有运气。

I've been messing around with PDFSharp and have had no luck.

我已经试过这样:<一href="http://www.pdfsharp.net/wiki/ExportImages-sample.ashx?AspxAutoDetectCookieSupport=1">http://www.pdfsharp.net/wiki/ExportImages-sample.ashx?AspxAutoDetectCookieSupport=1但它是所有在PDF文件中这是不期望的结果提取嵌入的图像。

I have tried this: http://www.pdfsharp.net/wiki/ExportImages-sample.ashx?AspxAutoDetectCookieSupport=1 but all it does is extract the embedded images in the PDF file which is not the desired result.

这是如何做到这一点的想法?任何人都知道一个好的库,可以处理呢?

Ideas on how to do this? Anyone know a good library that can handle this?

编辑:请让我知道这是为什么这么糟糕的问题。如果任何人有一个很好的解决了这一点,将是许多人一个很好的资源。特别是自谷歌搜索想出空。

Please let me know why this is such a bad question. If anyone has a good solution to this it would be a great resource for many other people. Especially since google searches come up empty.

推荐答案

Ghostscript的是目前的事实标准渲染PDF文件。这是一个有点棘手包装,甚至使用GhostScriptSharp。

Ghostscript is currently the de-facto standard for rendering PDFs. It's a bit tricky to wrap, even using GhostScriptSharp.

贾森 - 莫尔斯写了伟大的C#包装渲染PDF文件作为插件的开放源码的imageresizing.net库

Jason Morse wrote a great C# wrapper for rendering PDFs as a plugin to the open-source imageresizing.net library.

如果它是一个asp.net应用程序,该库允许在即时渲染,所以你可以再补充一个查询字符串,以获得JPEG / PNG版本:

If it's an asp.net application, the library allows on-the-fly rendering, so you can just add a querystring to get the jpeg/png version:

/pdfs/letter.pdf?format=jpg&page=2

您还可以使用管理API,而不是(在任何应用程序类型 - 不ASP.NET特定)

You can also use the managed API instead (in any application type - not asp.net specific)

ImageBuilder.Current.Build(letter.pdf,dest.jpg,新ResizeSet​​tings(格式= JPG,页面= 2));

ImageBuilder.Current.Build("letter.pdf","dest.jpg",new ResizeSettings("format=jpg;page=2"));

该PdfRenderer插件GPL许可的,就像Ghostscript的。

The PdfRenderer plugin is GPL licensed, just like Ghostscript.

这篇关于在C#中导出PDF格式为JPG(S)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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