PDF到图像 - Magick ++ [英] PDF to Image - Magick++

查看:303
本文介绍了PDF到图像 - Magick ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用magick ++将pdf转换为一系列图片。我目前有这个代码:

I want to convert a pdf to a series of images using magick++. I currently have this code:

Image  * img = new Image();
img->read(Tests+"finance-02-2007-multiples.pdf[0]");

测试是一个包含文件夹路径的变量。 [0]表示我想让第一页在图像中读取。

Tests is a variable which contains the folder path. The "[0]" means that I want the first page to read in an image.

但是,此代码段不工作。出现Magick :: ErrorDelegate异常。
我知道ImageMagick使用GhostScript来渲染页面。可能是我需要做一些事情在ImageMagick中的enalbe GhostScript首先?

However, this code snippet does not work. The exception "Magick::ErrorDelegate" appears. I know that ImageMagick uses GhostScript to render the page. Can it be that i need to do something to enalbe GhostScript in ImageMagick first?

还是有人有一个ide如何让代码工作?

Or has someone an ide how to get the code to work?

感谢这么多!

推荐答案

这个错误告诉你在你的电脑上找不到GhostScript 。

that error is telling you that cannot find GhostScript on your computer.

为了阅读PDF usig Magick,您必须安装GhostScript。 Magic有一个(有限的)内部支持,只有写一个pdf。它实际上是以pdf格式嵌入图像。原因是GhostScript被授权为GPL,并且不能包含在Magick中,但是幸运的是,如果用户安装的话,可以使用它。)

In order to read a PDF usig Magick, you must have GhostScript installed. Magic has a (limited) internal support only for writing a pdf. It actually embeds an image in in pdf. The reason is that GhostScript is licenced as GPL and cannot be included in Magick, but fortunately can be used if installed by user :).

Magick通过注册检查GhostScript 。确保您已安装了一个GhostScript版本,并且安装程序已在HKEY_CURRENT_USER或HKEY_LOCAL_MACHINE中创建以下键之一。

Magick checks for a GhostScript via registry. Make sure you have you installed a verion of GhostScript and that installation has created one of the keys below in HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE.

SOFTWARE\GPL Ghostscript,
SOFTWARE\GNU Ghostscript,
SOFTWARE\AFPL Ghostscript,
SOFTWARE\Aladdin Ghostscript

"SOFTWARE\GPL Ghostscript", "SOFTWARE\GNU Ghostscript", "SOFTWARE\AFPL Ghostscript", "SOFTWARE\Aladdin Ghostscript"

希望帮助

这篇关于PDF到图像 - Magick ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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