2014-09-30 94 views
1

我使用GhostScript的检查使用以下命令损坏的PDF文件:GhostScript的输出到文件

gswin64c.exe -o nul -sDEVICE=nullpage input.pdf 

和我在屏幕上的输出如下:

Processing pages 1 to 2. 
Page 1 
    *****Error reading a content stream. The page may not be incomplete. 
Page 2 
    *****Warning: File has insufficient data for an image. 

    *****This file had errors that were repaired or ignored. 

这些信息到底是什么我需要,但我需要在一个文本文件中输出,因为我将不得不处理大量的文件。

我尝试使用下面的命令:

gswin64c.exe -o outputfile.txt -sDEVICE=txtwrite input.pdf 

但OUTPUTFILE是空的。

如何将这些信息输出到文件中?

回答

1

尝试重定向​​到文件

如。

gswin64c.exe -o nul -sDEVICE=nullpage input.pdf > output.txt 2> errors.txt 
+0

谢谢 - 这正是我所需要的。有没有简单的方法将文件名添加到stdout和stderr? – user2105030 2014-09-30 15:56:06

+0

取决于您如何获得输入文件名,请尝试使用您用来决定处理哪个文件的相同机制,但是会附加一个.txt或.err文件。 – gbjbaanb 2014-09-30 17:08:50