Prev: Work at Home- Earn $4,000 Weekly With Email Reading Jobs
Next: Use shell command to judge whether a file is in pdf format ornot.
From: Hongyi Zhao on 15 Feb 2010 21:47 Hi all, I want to use shell command to judge whether a file is in pdf format or not. Any hints? -- ..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
From: Ben Finney on 15 Feb 2010 21:51 Hongyi Zhao <hongyi.zhao(a)gmail.com> writes: > I want to use shell command to judge whether a file is in pdf format > or not. Any hints? The 'file(1)' command queries file contents and identifies the type of data they contain. -- \ “If you continue running Windows, your system may become | `\ unstable.” —Microsoft, Windows 95 bluescreen error message | _o__) | Ben Finney
From: Fred on 16 Feb 2010 10:27 On Feb 16, 4:44 am, Hongyi Zhao <hongyi.z...(a)gmail.com> wrote: > On Tue, 16 Feb 2010 11:27:26 +0000, Ben Bacarisse > > <ben.use...(a)bsb.me.uk> wrote: > >In addition to 'file' you could use the exit code from pdfinfo. This > >is part of a suite of PDF manipulating programs that might not be > >available on your target systems, but it seems worth mentioning. > > Excellent tool! It's also available on my system. Thanks a lot. Note that just because the first line of a file begins with "%PDF-" it does not guarantee that the rest of the file is actually in PDF format. So the test can only determine that a file is either *not* PDF, or that the file is "might be PDF". -- Fred K
From: Ben Bacarisse on 16 Feb 2010 06:27 Hongyi Zhao <hongyi.zhao(a)gmail.com> writes: > I want to use shell command to judge whether a file is in pdf format > or not. Any hints? In addition to 'file' you could use the exit code from pdfinfo. This is part of a suite of PDF manipulating programs that might not be available on your target systems, but it seems worth mentioning. -- Ben.
From: Hongyi Zhao on 16 Feb 2010 07:44
On Tue, 16 Feb 2010 11:27:26 +0000, Ben Bacarisse <ben.usenet(a)bsb.me.uk> wrote: >In addition to 'file' you could use the exit code from pdfinfo. This >is part of a suite of PDF manipulating programs that might not be >available on your target systems, but it seems worth mentioning. Excellent tool! It's also available on my system. Thanks a lot. -- ..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. |