修复只有 ubuntu 才能打开的损坏的 Postscript 文件

修复只有 ubuntu 才能打开的损坏的 Postscript 文件

我尝试将 PostScript 文件从关联转换为 PDF,我可以在任何计算机上查看。当我尝试转换它时,我收到有关堆栈的错误:

Error: /rangecheck in --getinterval--
Operand stack:
(\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000...) 9 0 714 9 (\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000...) -714 9
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1862 1 3 %oparray_pop 1861 1 3 %oparray_pop 1845 1 3 %oparray_pop 1739 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- %loop_continue --nostringval-- --nostringval-- %loop_continue --nostringval--
Dictionary stack:
--dict:1145/1684(ro)(G)-- --dict:0/20(G)-- --dict:70/200(L)-- --dict:138/300(L)-- --dict:96/200(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 373434
GPL Ghostscript 8.64: Unrecoverable error, exit code 1 

当我尝试打印时,只能打印一半。幸运的是,我可以在 Ubuntu 的内置文档查看器中查看它(我可以访问所有页面,但无法将它们打印到文件中)。

我如何修复这个特定的 postscript 文件并将其转换为 pdf?

答案1

问题在于 PS 文件是可执行程序,可能会执行不正确的操作,从而扰乱 ghostscript 的虚拟机。根据 ghostscript 返回的位置判断,我已找到有问题的页面;它们是第 234(36) 页和第 250(52) 页。然后我在文本编辑器中打开 .ps 文件并搜索“%%Page: 234”和“%%Page: 250”,然后逐一剪切它们(一直剪切到下一个 %%Page 语句),并将 .ps 文件输入 ghostscript(无错误)。现在我有一个没有 2 页的 PDF。这些页面可以由擅长 PostScript 的人修复。

相关内容