Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question is related to this one - http://superuser.com/questions/197373/toolkit-tool-for-pdf-checking

I've installed "ghostscript" on my Windows system and it gives me a prompt to type in. I'm not sure what I should do next in order to read in my existing PDF files that I want to test (to see if they were formed properly).

share|improve this question
    
The question is to vague to be answered. What is it that you're trying to do? Just view the PDF? If so, then use ghostview not ghostscript--or just use Adobe Reader, which is the standard. –  frabjous Oct 16 '10 at 22:41
    
I need to see if the PDF files I downloaded are properly formed. THere are hundreds of them, and some of them may have broken during the file transfer. Adobe Reader is very forgiving and opens them without issue, but i cannot check every page of every document to see if its alright... –  matt74tm Oct 17 '10 at 3:39
    
did you try the corrected command as outlined in my last comment below? –  Kurt Pfeifle Jun 21 '11 at 11:42
add comment

2 Answers

If you use Ghostscript on Windows, you'll have two executables:

  1. gswin32c.exe
  2. gswin32.exe

The first one is to be run from inside a 'DOS box' (i.e. cmd.exe window) -- either interactively or not. It prints all stderr/stdout messages into the cmd.exe window and also expects any input commands to be typed in there.

The second one opens a separate Window for "interactivity': prints stderr/stdout to separate window, and expects commands there.

To avoid the 'prompt to type in', you have to use the right commandline parameters when you call either one of the commands. For example:

gswin32c.exe -dBATCH -dNOPAUSE

-dNOPAUSE processes all pages of the input file (instead of pausing after each one). -dBATCH avoids the return to the gs> prompt after the last page.

A complete command for Ghostscript to test your PDF would be (inside a DOS box) to run

gswin32c -o nul -sDEVICE=nullpage c:/path/to/input.pdf

(the -o parameter implicitly uses -dBATCH -dNOPAUSE.) -sDEVICE=nullpage doesn't do any conversion and doesn't write an output file. But it makes Ghostscript to run all the rendering commands of the input PDF. Should the input be invalid, Ghostscript will tell you with its stdout/stderr messages.

share|improve this answer
1  
Umm - it seems with the -o option, it doesnt retain the stdout/error messages. If I remove it, it prompts me for every page (both when no errors are present and when they are) –  matt74tm Oct 19 '10 at 3:07
1  
@matt_tm: sorry, my mistake. -o nul seems to direct all output to the nul device. Don't use -o then. Use gs -dBATCH -dNOPAUSE -sDEVICE=nullpage /path/to/input.pdf (Linux) or gswin32c -dNOPAUSE -sDEVICE=nullpage c:/path/to/input.pdf (Windows). –  Kurt Pfeifle Oct 19 '10 at 10:40
    
@matt74tm: Did you meanwhile try my modified command? –  Kurt Pfeifle Jun 2 '11 at 13:07
    
@KurtPfeifle I've tried it, it works. –  Vnuk Oct 7 '12 at 10:03
    
fwiw, -o nul with v9.02 (x64) on my Win7 machine shows both info and error messages. –  matt wilkie Jun 17 '13 at 18:51
add comment

If you want to look inside the PDF you can use various tools to see the object structure. I wrote blog articles on using CanOpener (http://www.jpedal.org/PDFblog/?p=627), PDFedit (http://www.jpedal.org/PDFblog/?p=452) and Acrobat (http://www.jpedal.org/PDFblog/?p=283).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.