[poppler] 3 commits - utils/CMakeLists.txt utils/Makefile.am utils/pdfextract.1 utils/pdfextract.cc utils/pdfmerge.1

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Sep 18 09:20:47 PDT 2011


 utils/CMakeLists.txt |    2 ++
 utils/Makefile.am    |    2 ++
 utils/pdfextract.1   |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 utils/pdfextract.cc  |    4 ++++
 utils/pdfmerge.1     |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 88 insertions(+)

New commits:
commit b828f63ed3896a22f3fe7ddbe2ec2f549d7a2c62
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 18 18:20:47 2011 +0200

    install pdfextract and pdfmerge manpages

diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 90030cd..a36616d 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -109,6 +109,7 @@ set(pdfextract_SOURCES ${common_srcs}
 add_executable(pdfextract ${pdfextract_SOURCES})
 target_link_libraries(pdfextract ${common_libs})
 install(TARGETS pdfextract DESTINATION bin)
+install(FILES pdfextract.1 DESTINATION share/man/man1)
 
 # pdfmerge
 set(pdfmerge_SOURCES ${common_srcs}
@@ -117,3 +118,4 @@ set(pdfmerge_SOURCES ${common_srcs}
 add_executable(pdfmerge ${pdfmerge_SOURCES})
 target_link_libraries(pdfmerge ${common_libs})
 install(TARGETS pdfmerge DESTINATION bin)
+install(FILES pdfmerge.1 DESTINATION share/man/man1)
commit 986759dfbe85998c85ee9b0825c7522395567531
Author: Thomas Freitag <Thomas.Freitag at kabelmail.de>
Date:   Sun Sep 18 18:19:30 2011 +0200

    pdfextract and pdfmerge man pages

diff --git a/utils/Makefile.am b/utils/Makefile.am
index 30328f2..ac2a15e 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -62,6 +62,8 @@ dist_man1_MANS =				\
 	pdftops.1				\
 	pdftotext.1				\
 	pdftohtml.1				\
+	pdfextract.1				\
+	pdfmerge.1				\
 	$(pdftoppm_manpage)			\
 	$(pdftocairo_manpage)
 
diff --git a/utils/pdfextract.1 b/utils/pdfextract.1
new file mode 100644
index 0000000..429e66d
--- /dev/null
+++ b/utils/pdfextract.1
@@ -0,0 +1,48 @@
+.\" Copyright 2011 The Poppler Developers - http://poppler.freedesktop.org
+.TH pdfextract 1 "15 September 2011"
+.SH NAME
+pdfextract \- Portable Document Format (PDF) page extractor
+.SH SYNOPSIS
+.B pdfextract
+[options]
+.I PDF-file PDF-page-pattern
+.SH DESCRIPTION
+.B pdfextract
+extract single pages from a Portable Document Format (PDF).
+.PP
+pdfextract reads the PDF file
+.IR PDF-file ,
+extracts one or more pages, and writes one PDF file for each page to
+.IR PDF-page-pattern,
+PDF-page-pattern should contain
+.B %d
+.%d is replaced by the page number
+.TP
+The PDF-file should not be encrypted.
+.SH OPTIONS
+.TP
+.BI \-f " number"
+Specifies the first page to extract. If -f is omitted, extraction starts with page 1.
+.TP
+.BI \-l " number"
+Specifies the last page to extract. if -p is omitted, extraction ends with the last page.
+.TP
+.B \-v
+Print copyright and version information.
+.TP
+.B \-h
+Print usage information.
+.RB ( \-help
+and
+.B \-\-help
+are equivalent.)
+.SH EXAMPLE
+pdfextract sample.pdf sample-%d.pdf
+.TP
+extracts all pages from sample.pdf, if i.e. sample.pdf has 3 pages, it produces
+.TP
+sample-1.pdf, sample-2.pdf, sample-3.pdf
+.SH AUTHOR
+The pdfextract software and documentation are copyright 2011 The Poppler Developers - http://poppler.freedesktop.org
+.SH "SEE ALSO"
+.BR pdfmerge (1),
diff --git a/utils/pdfmerge.1 b/utils/pdfmerge.1
new file mode 100644
index 0000000..a6571d1
--- /dev/null
+++ b/utils/pdfmerge.1
@@ -0,0 +1,32 @@
+.\" Copyright 2011 The Poppler Developers - http://poppler.freedesktop.org
+.TH pdfmerge 1 "15 September 2011"
+.SH NAME
+pdfmerge \- Portable Document Format (PDF) page merger
+.SH SYNOPSIS
+.B pdfmerge
+[options]
+.I PDF-sourcefile1..PDF-sourcefilen PDF-destfile
+.SH DESCRIPTION
+.B pdfmerge
+merges several PDF (Portable Document Format)  files in order of their occurence on command line to one PDF result file.
+.TP
+Neither of the PDF-sourcefile1 to PDF-sourcefilen should be encrypted.
+.SH OPTIONS
+.TP
+.B \-v
+Print copyright and version information.
+.TP
+.B \-h
+Print usage information.
+.RB ( \-help
+and
+.B \-\-help
+are equivalent.)
+.SH EXAMPLE
+pdfmerge sample1.pdf sample2.pdf sample.pdf
+.TP
+merges all pages from sample1.pdf and sample2.pdf (in that order) and creates sample.pdf
+.SH AUTHOR
+The pdfmerge software and documentation are copyright 2011 The Poppler Developers - http://poppler.freedesktop.org
+.SH "SEE ALSO"
+.BR pdfextract (1),
commit 90da1af542fd7f3cecef31b15da6971345b38209
Author: Thomas Freitag <Thomas.Freitag at kabelmail.de>
Date:   Sun Sep 18 18:19:04 2011 +0200

    Complain if %d is not present and it should

diff --git a/utils/pdfextract.cc b/utils/pdfextract.cc
index c8c4749..d6a7eb5 100644
--- a/utils/pdfextract.cc
+++ b/utils/pdfextract.cc
@@ -63,6 +63,10 @@ bool extractPages (const char *srcFileName, const char *destFileName) {
     lastPage = doc->getNumPages();
   if (firstPage == 0)
     firstPage = 1;
+  if (firstPage != lastPage && strstr(destFileName, "%d") == NULL) {
+    error(-1, "'%s' must contain '%%d' if more than one page should be extracted", destFileName);
+    return false;
+  }
   for (int pageNo = firstPage; pageNo <= lastPage; pageNo++) {
     sprintf (pathName, destFileName, pageNo);
     GooString *gpageName = new GooString (pathName);


More information about the poppler mailing list