How can I render PDF file pages as images?
I need to be able to convert a PDF file to images (one image per page) to be displayed on a web page like Google Docs does. This is for an internal intranet application where the requirements call for a PDF file on the web but with the ability to track scrolling, and this is the only way I can come up with to do it.
The problem is I can't find a good way to c开发者_JS百科onvert PDF files on the fly.
Try GhostScript. It's open source and can by run as a command line process or directly through the DLL. I've used this in a production app for the last 2 years with minimal problems.
To see how to export images using the dll directly, see this codeproject article.
We use ABCpdf here to convert PDFs to images.
Note: it is NOT free
You can use ImageMagik, it's free and can do that kind of conversion.
http://www.imagemagick.org
Try the PDF components from Tall Components to convert to images.
You will need to look into these a bit further to track changes etc and may require converting to text.
PeaPDF
I created a free open source project for rendering PDFs - https://github.com/elicym/peapdf/.
Ghostscript
You can also use Ghostscript, but its license is AGPL, and you will likely need to distribute your code if you use it. See https://www.ghostscript.com/license.html, especially the part:
Bottom line, if you distribute our software, or make the functionality of the software available to users interacting with it remotely through a computer network, you must share your source code.
精彩评论