3

为什么我的 PDF 创建过程的最后一部分失败了。请参阅下面 ps2pdf 命令的输出。这是我自己开发的工具链的末尾。我从 Matlab 中获取图像,使用 LaTeX 将它们拼接在一起,然后使用 latexmk 创建最终的 PDF。

到目前为止,当相关文档增长到 3356 页时,这一直运行良好!

文件 output.ps 中的文件位置 238282(如 ghostscript 错误输出中所述)位于“SDict begin [ {Catalog} << /PageLabels<>1<>2” 行的末尾。这一行有 51542 个字符长,描述了所有 3356 个页面。

现在这条线的长度是不是太长了?如果我将 .tex 文件缩减到 3000 页并重新运行 latexmk,它就可以完成。

单独运行 ps2pdf 以显示错误。从 latexmk 运行时出现同样的错误:

C:\temp>c:\MiKTeX\miktex\bin\ps2pdf.exe output.ps output.pdf > error.txt 2>&1

给出输出:

Error: /limitcheck in --string--
Operand stack:
   --nostringval--   --nostringval--   --dict:1/1(L)--   PUT   --nostringval--   2   --nostringval--   2   false   --nostringval--   --nostringval--   (])   --nostringval--   --nostringval--   (3327)   --nostringval--   --nostringval--   P   1   .pdfcvstring   (<<\n/P \(3225\)\n>> 3226 <<\n/P \(32)   (<<\n/Nums [0 <<\n/P \(1\)\n>> 1 <<\n/P \(1\)\n>> 2 <<\n/P \(2\)\n>> 3 <<\n/P \(3\)\n>> 4 <<\n/P \(4\)\n>> 5 <<\n/P \(5\)\n>> 6 <<\n/P \(6\)\n>> 7 <<\n/P \(7\)\n>> 8 <<\n/P \(8\)\n>> 9 <<\n/P \(9\)\n>> 10 <<\n/P \(10\)\n>> 11 <<\n/P \(11\)\n>> 12 <<\n...)   65550
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1917   4   5   %oparray_pop   --nostringval--   3   1   2   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --dict:1/1(L)--   --nostringval--   1   %dict_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --dict:1/1(L)--   --nostringval--   1   %dict_continue   --nostringval--   --nostringval--   %zwritecvp_continue   1   %s_proc_write_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1159/1684(ro)(G)--   --dict:0/20(G)--   --dict:81/200(L)--   --dict:188/300(L)--   --dict:36/200(L)--   --dict:10/10(G)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 238282
MiKTeX GPL Ghostscript  9.00: Unrecoverable error, exit code 1

编辑:从进入 ps2pdf 的 postscript 文件中添加了我完整的页面标签行。请参阅 pastebin 条目http://pastebin.com/FFvZpaRY

4

1 回答 1

3

我运行pdfmark您提供 9.10 的pdfwrite设备没有错误,但 9.00 失败并显示与您显示的相同消息。

更新: 假设您需要的页面标签是 1,1,2,3...3261(不知道为什么,但这就是您的示例),添加自动递增数字标签而不是字符串前缀更简单像你一样做。

[{Catalog}<<
/PageLabels<</Nums[0<</S/D>>1<</S/D>>]>>
>> /PUT pdfmark

或者,如果需要前缀,请将您的大数组分成两个或更多:

[/_objdef{leaf1}/type/dict/OBJ pdfmark
[/_objdef{leaf2}/type/dict/OBJ pdfmark
[{leaf1}<</Limits[0 3000]
/Nums[
... 0 to 3000 labels go here ...
>>/PUT pdfmark
[{leaf2}<</Limits[3001 3261]
/Nums[
... 3001 to 3261 labels go here ...
>>/PUT pdfmark
[{Catalog}<</PageLabels<</Kids[{leaf1} {leaf2}]>>
>>/PUT pdfmark

这两种解决方案都适用于 9.00

于 2013-11-06T21:00:52.477 回答