Skip to content

Instantly share code, notes, and snippets.

@sgringwe
Created September 27, 2015 23:07

Revisions

  1. sgringwe created this gist Sep 27, 2015.
    29 changes: 29 additions & 0 deletions check-pdf-validity.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    gs -dNOPAUSE -dBATCH -sDEVICE=nullpage valid.pdf
    GPL Ghostscript 9.16 (2015-03-30)
    Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
    This software comes with NO WARRANTY: see the file PUBLIC for details.
    Processing pages 1 through 1.
    Page 1

    (return code 0)

    : gs -dNOPAUSE -dBATCH -sDEVICE=nullpage invalid.pdf
    GPL Ghostscript 9.16 (2015-03-30)
    Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
    This software comes with NO WARRANTY: see the file PUBLIC for details.
    **** This file uses an unknown security handler.
    **** The file was produced by:
    ��+dr��� <<<<��.]��{[1$3*M=��]H&T��v�U@�r�,t�
    Error: /undefined in pdf_process_Encrypt
    Operand stack:

    Execution stack:
    %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1951 1 3 %oparray_pop 1950 1 3 %oparray_pop 1934 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push --nostringval--
    Dictionary stack:
    --dict:1182/1684(ro)(G)-- --dict:1/20(G)-- --dict:83/200(L)-- --dict:83/200(L)-- --dict:117/127(ro)(G)-- --dict:280/300(ro)(G)-- --dict:22/32(L)--
    Current allocation mode is local
    Last OS error: Invalid argument
    GPL Ghostscript 9.16: Unrecoverable error, exit code 1
    :

    (return code 1)