summaryrefslogtreecommitdiff
path: root/utils/pdftohtml.cc
diff options
context:
space:
mode:
Diffstat (limited to 'utils/pdftohtml.cc')
-rw-r--r--utils/pdftohtml.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index bcec8cb7..aabed0b7 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -16,12 +16,13 @@
// Copyright (C) 2007-2008, 2010, 2012 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2010 Mike Slegeir <tehpola@yahoo.com>
-// Copyright (C) 2010 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
+// Copyright (C) 2010, 2013 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
// Copyright (C) 2010 OSSD CDAC Mumbai by Leena Chourey (leenac@cdacmumbai.in) and Onkar Potdar (onkar@cdacmumbai.in)
// Copyright (C) 2011 Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk>
// Copyright (C) 2012 Igor Slepchin <igor.redhat@gmail.com>
// Copyright (C) 2012 Ihar Filipau <thephilips@gmail.com>
// Copyright (C) 2012 Luis Parravicini <lparravi@gmail.com>
+// Copyright (C) 2014 Pino Toscano <pino@kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -104,8 +105,12 @@ static const ArgDesc argDesc[] = {
"don't print any messages or errors"},
{"-h", argFlag, &printHelp, 0,
"print usage information"},
+ {"-?", argFlag, &printHelp, 0,
+ "print usage information"},
{"-help", argFlag, &printHelp, 0,
"print usage information"},
+ {"--help", argFlag, &printHelp, 0,
+ "print usage information"},
{"-p", argFlag, &printHtml, 0,
"exchange .pdf links by .html"},
{"-c", argFlag, &complexMode, 0,
@@ -196,7 +201,7 @@ int main(int argc, char *argv[]) {
if (!printVersion) {
printUsage("pdftohtml", "<PDF-file> [<html-file> <xml-file>]", argDesc);
}
- exit(1);
+ exit(printHelp || printVersion ? 0 : 1);
}
// init error file
@@ -322,6 +327,12 @@ int main(int argc, char *argv[]) {
firstPage = 1;
if (lastPage < 1 || lastPage > doc->getNumPages())
lastPage = doc->getNumPages();
+ if (lastPage < firstPage) {
+ error(errCommandLine, -1,
+ "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
+ firstPage, lastPage);
+ goto error;
+ }
doc->getDocInfo(&info);
if (info.isDict()) {