标签: ghostscript

ImageMagick/Imagick使用本机PHP API将PDF转换为JPG

我正在尝试将PDF文件转换为PNG.它在命令行中运行良好(我安装了GhostScript 8.64).但是从PHP我遇到了一个问题:

码:

$im = new Imagick($pdf_file); // this is where it throws the exception below
Run Code Online (Sandbox Code Playgroud)

输出:

Fatal error: Uncaught exception ‘ImagickException’ with message ‘Postscript delegate failed `23_1235606503.pdf’: No such file or directory @ pdf.c/ReadPDFImage/612? in get_thumbnail.php:93
Stack trace:
\#0 get_thumbnail.php(93): Imagick->__construct(’…’)
Run Code Online (Sandbox Code Playgroud)

等等

我不确定我在这里做错了什么,但我怀疑它与某处的服务器配置有关.我正在运行:Apache 2.2.11 PHP 5.2.8 ImageMagick 6.4.8-9 GhostScript 8.64

php pdf pdf-generation image ghostscript

12
推荐指数
2
解决办法
2万
查看次数

将多页PDF转换为单个图像

我正在尝试使用GhostScript将PDF转换为单个图像.

只转换了第一页,而我的目的是生成一个可怕的高PNG/JPG图像,所有页面连接在一起.

这些是我当前传递给GhostScript DLL的参数(通过.NET应用程序):

pdf2img \
  -dNOPAUSE \
  -dBATCH \
  -dSAFER \
  -sDEVICE=png256 \
  -dGraphicsAlphaBits=4 \
  -dTextAlphaBits=4 \
  -dDOINTERPOLATE \
  -dAlignToPixels=1 \
  -r300x300 \
  -sOutputFile=GLOSS.png \
   GLOSS.pdf
Run Code Online (Sandbox Code Playgroud)

是否可以通过GhostScript将所有页面连接在一起?或者我应该采用外部方法?

pdf ghostscript

12
推荐指数
1
解决办法
2万
查看次数

如何在PostScript中确定字符串高度?

我需要在postscript中确定字符串的高度(以给定的比例和字体).

/Helvetic-Oblique findfont
10 scalefont
setfont
10 10 1 0 360 arc fill
10 10 moveto (test) dup stringwidth pop 2 div neg 0 rmoveto show
Run Code Online (Sandbox Code Playgroud)

将在(10,10)水平(但尚未垂直)打印测试.(看到这个,我还在10,10处显示一个小圆圈).我还需要确定字符串高度以使文本垂直居中,但我无法找到它的功能.

postscript ghostscript

12
推荐指数
2
解决办法
4612
查看次数

如何合并PDF文件(如果不可能,则为PS),以便每个文件都以奇数页开头?

我正在开发一个UNIX系统,我想将数千个PDF文件合并到一个文件中以便打印它.我不知道他们提前有多少页.

我想双面打印,这样两个文件就不会在同一页面上.

因此,我将合并文件对齐,使得每个文件将以奇数页开始,如果下一个要写的页是偶数页,则将添加空白页.

unix pdf pdf-generation postscript ghostscript

12
推荐指数
2
解决办法
3758
查看次数

如何使用Ghostscript或ImageMagick从PDF中提取图像?

我需要渲染或获取特定PDF文件中的所有图像.如何使用Ghostscript或ImageMagick实现此目的?

java imagemagick ghostscript

12
推荐指数
2
解决办法
7995
查看次数

Ghostscript真正的黑白转换

我正在尝试将颜色pdf转换为纯黑色和白色tiff,即如果颜色不是白色,我希望它是纯黑色.目前我的色线变得斑驳而微弱,我认为这是由于半色调.有没有办法可以覆盖这种半色调?以下示例.

电流输出:

电流输出

期望的输出:

期望的输出

谢谢.

ghostscript

12
推荐指数
1
解决办法
437
查看次数

印章PDF文件,控制印章文件的位置

有没有人知道将PDF文件标记为PDF文件以及定位PDF文件标记的控件?

我有一个文件orginal.pdflogo.pdf.我想将logo.pdf文件标记到文件orginal.pdf左上角的文件中original.pdf.如何使用Ghostscriptpdftk完成

pdf ghostscript pdftk

11
推荐指数
1
解决办法
8220
查看次数

Ghostscript Dll的简单VB.Net包装器

我爱Ghostscript.您可以使用它将pdf转换为图形文件,拆分和/或合并pdf文件,制作缩略图以及一大堆其他内容.而且,它是免费的开源软件!

网站上有大量帖子关于如何从命令行使用Ghostscript用于各种平台.但是,我永远找不到一个简单的 vb.net dll包装器,它使用Ghostscript dll(gsdll32.dll)而不是启动进程来运行Ghostscript命令行应用程序.

所以,我想出了这段代码.我在这里发帖,希望其他人可以避免我想要寻找简单直接的挫折感.它避免了你在某些代码中看到的那些愚蠢的字节数组对象数组.它具有最小的错误处理,但可以添加以适合您的应用程序.

将此代码放在名为"GhostscriptDllLib"的模块中.

Option Explicit On
Imports System.Runtime.InteropServices

'--- Simple VB.Net wrapper for Ghostscript gsdll32.dll

'    (Tested using Visual Studio 2010 and Ghostscript 9.06)

Module GhostscriptDllLib

  Private Declare Function gsapi_new_instance Lib "gsdll32.dll" _
    (ByRef instance As IntPtr, _
    ByVal caller_handle As IntPtr) As Integer

  Private Declare Function gsapi_set_stdio Lib "gsdll32.dll" _
    (ByVal instance As IntPtr, _
    ByVal gsdll_stdin As StdIOCallBack, _
    ByVal gsdll_stdout As StdIOCallBack, _
    ByVal gsdll_stderr As StdIOCallBack) As Integer

  Private Declare Function …
Run Code Online (Sandbox Code Playgroud)

vb.net dll ghostscript

11
推荐指数
0
解决办法
7489
查看次数

embedFonts抱怨"未知设备:pswrite"

运行embedFonts我创建的一些EPS文件,我收到一条错误消息:

> embedFonts("foo.ps")
Unknown device: pswrite
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
Error in embedFonts("foo.ps") : 
  status 1 in running command 'gs -dNOPAUSE -dBATCH -q -dAutoRotatePages=/None -sDEVICE=pswrite -sOutputFile=/tmp/Rtmp3Lv0dj/Rembed2cd86df573a1 '-sFONTPATH='  'foo.ps''
Run Code Online (Sandbox Code Playgroud)

我怎样才能避免这个错误?

fonts r postscript ghostscript font-embedding

11
推荐指数
1
解决办法
4096
查看次数

如何从PDF中删除所有图像?

我想从PDF文件中删除所有图像.

页面布局不应更改.所有图像都应该用空格替换.

  • 如何在Ghostscript和相应的PostScript代码的帮助下实现这一目标?

pdf postscript ghostscript

10
推荐指数
2
解决办法
3242
查看次数

标签 统计

ghostscript ×10

pdf ×5

postscript ×4

pdf-generation ×2

dll ×1

font-embedding ×1

fonts ×1

image ×1

imagemagick ×1

java ×1

pdftk ×1

php ×1

r ×1

unix ×1

vb.net ×1