Am 17.09.2011 17:21, schrieb Albert Astals Cid:
A Dissabte, 17 de setembre de 2011, Thomas Freitag vàreu escriure:
Sorry, Albert!
Your previous mail reaches me during my vacation. After I started
reading my mails again, I had tons of poppler mails in my mailbox, so I
decided to move them into an archive to read them later, when I have the
time to do it. That's why I missed it (and even that You commit my patch
:-) )
I now quickly created two man pages. Are they sufficient and more
important understandable?
Hmm, reading the behaviour of pdfextract, i see that it differs a bit from
e.g. pdftoppm in which you do not need to define the %d and the page numbers
are appended automatically.
I see that your way is a bit more powerful, since it allows to have the number
at the beginning.
What I would like you to do is:
a) Complain if no %d is in the pattern, e.g. right now
./pdfextract -f 1 -l 2 input.pdf ouput
Only extracts page 2 (page 1 is probably extracted and then overwritten)
b) If no %d is in the pattern, just append the page number
I am fine with any of them.
I decided to implement a) with one small change: if only one page should
be extracted pdfextract doesn't complain if %d is missing, i.e.
../pdfextract -f 1 -l 1 input.pdf firstpage.pdf
is still possible.
I attach a complete patch containing the man pages, too, and also the
changes in Makefile.am so that the man pages are installed automatically.
Thomas
The manpages look fine, but i'll hold commiting until you decide if you want
to implement a) or b)
Do you think you can do that before the 26th that is when we are releasing
poppler 0.18.0?
Albert
Thomas
Am 16.09.2011 15:50, schrieb Albert Astals Cid:
Thomas? Any chance we can get those man pages soon-ish?
Albert
A Dilluns, 29 d'agost de 2011, Albert Astals Cid vàreu escriure:
A Dijous, 31 de març de 2011, Thomas Freitag vàreu escriure:
On 25.03.2011 21:42, Albert Astals Cid wrote:
A Dilluns, 20 de desembre de 2010, Thomas Freitag va escriure:
Hi all!
Hi
Hi again!
Sorry for this late but therefore now more correct answer. As you
probably know I was very busy implementing overprint, and after that
I
took some "free poppler" days!
How I promised long time ago, here now a patch for the poppler
writing
routines and some new helper function, together with two small
sample
programs using them.
I'm resending the patch because what you sent was unnecesarily big
and
scary (which diff program you use?).
I took now Your resent patch as base, completely reviewed it
(hopefully
nothing missing) and add the small utility programs pdfextract and
pdfmerge to the patch after learning a little bit more about git.
This
patch is now created under ubuntu, so hopefully it is not bigger as
necessary and not so scary. I also renamed the methods according to
the
poppler naming conventions, and the utility programs now give up
with an error message, if the or one of the PDFs are encrypted
instead of creating unreadable PDF(s).
Basically there are a few stilistic things i don't like (please
don't
use
this->)
I removed them now.
Also do you really need to have things like ExtractPage in PDFDoc?
Not
sure they make sense to me there
It would be a greater task to move it to pdfextract (and in addition
all the mark methods), but it is probably doable. But on the other
hand there are already routines like saveAs in PDFDoc, so I just
rename it to savePageAs to clearify it. But if You still insist to
remove them, I'll try it.
Hopefully we are not doing work twice. As I read once again Your
posting, I thought that I should do something more on it.
I've commited this patch. Please create man pages for pdfextract and
pdfmerge and send them in as soon as possible so we can include them
in
poppler 0.18
Albert
Thomas
Albert
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler
.
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler
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),
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.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);
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler