1

在大于约 600KB 的 PDF 上使用此命令时

<? passthru("convert -verbose -scale '200x200+0+0>' ".$pdf."[0] $image"); ?>

我得到这个错误输出:

ERROR: /rangecheck in resolveR
Operand stack:
   PageCount   4763294   47   46
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1129/1686(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--   --dict:107/200(L)--   --dict:104/127(ro)(G)--   --dict:241/347(ro)(G)--   --dict:16/24(L)--
Current allocation mode is local

有人对这些较大的文件有解决方法吗?我需要从 4 MB 大的文件中提取第 1 页的缩略图。

下面的 Per Kurt 我也尝试直接访问 gs:

<?
    $image = "3.jpg";
    $pdf = '3/ABS_Survey_for_Load_Lines_CIB_100.pdf';
    if (!file_exists($image)) {
        echo passthru("gs \
-sOutputFile=$image \
-sDEVICE=jpeg \
-g200x200 \
-dPDFFitPage \
 $pdf");
    }
?>

这给出了同样的错误:

ESP Ghostscript 815.02 (2006-04-19)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
ERROR: /rangecheck in resolveR
Operand stack:
   PageCount   4763294   47   46
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1122/1686(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--   --dict:107/200(L)--   --dict:104/127(ro)(G)--   --dict:241/347(ro)(G)--   --dict:16/24(L)--
Current allocation mode is local
4

2 回答 2

1

坏消息!我正在使用有问题的 PDF 使用在线转换器,它给出了“错误的 pdf”错误。请注意,所有 PDF 都将在 Acrobat 中打开,但我拿走了一些有问题的文件,并使用我的 Acrobat 9 重新保存了它们,瞧瞧,缩略图的创建没有问题……

所以这个问题与造船厂用来制作 PDF 的任何软件有关。

于 2012-07-26T22:26:49.830 回答
1

ImageMagickconvert本身不会打开和处理 PDF 文件。相反,它用作 PDF 输入 Ghostscript 的 代表

您显示的错误是典型的 Ghostscript 错误消息。

要调试这个,你应该先尝试直接运行Ghostscript ,看看是否真的是Ghostscript的错:

gs \
  -dBATCH \
  -dNOPAUSE \
  -sOutputFile=200x200px-output.jpeg \
  -sDEVICE=jpeg \
  -g200x200 \
  -dPDFFitPage \
   2000-kilobyte-input.pdf

另外,查找您拥有的 Ghostscript 版本:gs -v. (您应该使用最新版本,例如 9.05)


更新:

由于您的 Ghostscript 版本(ESPGS 8.15.2)...

  • ...超过 6 年(当时 PDF-1.6 和 Acrobat 7 是 PDF 的最新版本),
  • ...但是由于您很可能正在处理最新的 PDF 格式(PDF-1.7 和 Acrobat X 现在是最新的),

...建议您也将 Ghostscript(必须使用此类新文件)升级到当前版本。

于 2012-07-26T21:08:59.520 回答