Control: tag 723121 + patch On 09/16/2013 01:28 PM, Pino Toscano wrote: > forwarded 723121 https://bugs.freedesktop.org/show_bug.cgi?id=50914
thanks for the pointer, pino.
attached is a patch that permits zero-padded pagespecs up to %09d. I've
also submitted it to the upstream tracker.
Regards,
--dkg
--- a/utils/pdfseparate.cc 2013-09-16 13:26:25.403397896 -0400
+++ b/utils/pdfseparate.cc 2013-09-16 13:47:01.352602022 -0400
@@ -61,9 +61,24 @@
lastPage = doc->getNumPages();
if (firstPage == 0)
firstPage = 1;
- if (firstPage != lastPage && strstr(destFileName, "%d") == NULL) {
- error(errSyntaxError, -1, "'{0:s}' must contain '%%d' if more than one page should be extracted", destFileName);
- return false;
+ if (firstPage != lastPage) {
+ bool foundmatch = false;
+ if (strstr(destFileName, "%d") != NULL) {
+ foundmatch = true;
+ } else {
+ char pattern[5];
+ for (int i = 2; i < 10; i++) {
+ sprintf(pattern, "%%0%dd", i);
+ if (strstr(destFileName, pattern) != NULL) {
+ foundmatch = true;
+ break;
+ }
+ }
+ }
+ if (!foundmatch) {
+ error(errSyntaxError, -1, "'{0: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);
signature.asc
Description: OpenPGP digital signature

