diff -u poppler-0.11.0/debian/changelog poppler-0.11.0/debian/changelog --- poppler-0.11.0/debian/changelog +++ poppler-0.11.0/debian/changelog @@ -1,3 +1,12 @@ +poppler (0.11.0-0ubuntu3) karmic; urgency=low + + * debian/patches/10_pdftops-multiple-page-size-support.patch: Added new + output mode to the PostScript output device, so that the original page + sizes of PDF documents with multiple page sizes stay conserved + (LP: 382379). + + -- Till Kamppeter Mon, 1 Jun 2009 14:29:49 +0200 + poppler (0.11.0-0ubuntu2) karmic; urgency=low * debian/libpoppler-dev.install: Added missing header files to only in patch2: unchanged: --- poppler-0.11.0.orig/debian/patches/10_pdftops-multiple-page-size-support.patch +++ poppler-0.11.0/debian/patches/10_pdftops-multiple-page-size-support.patch @@ -0,0 +1,116 @@ +diff -Nur -x '*.orig' -x '*~' poppler-0.11.0/poppler/PSOutputDev.cc poppler-0.11.0.new/poppler/PSOutputDev.cc +--- poppler-0.11.0/poppler/PSOutputDev.cc 2009-05-11 19:59:09.000000000 +0200 ++++ poppler-0.11.0.new/poppler/PSOutputDev.cc 2009-06-01 13:14:30.000000000 +0200 +@@ -1269,6 +1269,7 @@ + Object info, obj1; + + switch (mode) { ++ case psModePSOrigPageSizes: + case psModePS: + writePS("%!PS-Adobe-3.0\n"); + break; +@@ -1299,6 +1300,7 @@ + writePS("%%DocumentSuppliedResources: (atend)\n"); + + switch (mode) { ++ case psModePSOrigPageSizes: + case psModePS: + writePSFmt("%%DocumentMedia: plain {0:d} {1:d} 0 () ()\n", + paperWidth, paperHeight); +@@ -3122,7 +3124,7 @@ + GBool landscape; + + +- if (mode == psModePS) { ++ if (mode == psModePS || mode == psModePSOrigPageSizes) { + GooString pageLabel; + const GBool gotLabel = m_catalog->indexToLabel(pageNum -1, &pageLabel); + if (gotLabel) { +@@ -3150,6 +3152,27 @@ + + switch (mode) { + ++ case psModePSOrigPageSizes: ++ x1 = (int)floor(state->getX1()); ++ y1 = (int)floor(state->getY1()); ++ x2 = (int)ceil(state->getX2()); ++ y2 = (int)ceil(state->getY2()); ++ width = x2 - x1; ++ height = y2 - y1; ++ if (width > height) { ++ landscape = gTrue; ++ } else { ++ landscape = gFalse; ++ } ++ writePSFmt("%%PageOrientation: {0:s}\n", ++ landscape ? "Landscape" : "Portrait"); ++ writePSFmt("<> setpagedevice\n", width, height); ++ writePS("pdfStartPage\n"); ++ writePSFmt("{0:d} {1:d} {2:d} {3:d} re W\n", x1, y1, x2 - x1, y2 - y1); ++ writePS("%%EndPageSetup\n"); ++ ++seqPage; ++ break; ++ + case psModePS: + // rotate, translate, and scale page + imgWidth = imgURX - imgLLX; +diff -Nur -x '*.orig' -x '*~' poppler-0.11.0/poppler/PSOutputDev.h poppler-0.11.0.new/poppler/PSOutputDev.h +--- poppler-0.11.0/poppler/PSOutputDev.h 2009-05-11 19:59:09.000000000 +0200 ++++ poppler-0.11.0.new/poppler/PSOutputDev.h 2009-06-01 13:14:30.000000000 +0200 +@@ -53,7 +53,8 @@ + enum PSOutMode { + psModePS, + psModeEPS, +- psModeForm ++ psModeForm, ++ psModePSOrigPageSizes + }; + + enum PSFileType { +diff -Nur -x '*.orig' -x '*~' poppler-0.11.0/utils/pdftops.cc poppler-0.11.0.new/utils/pdftops.cc +--- poppler-0.11.0/utils/pdftops.cc 2008-11-08 20:00:30.000000000 +0100 ++++ poppler-0.11.0.new/utils/pdftops.cc 2009-06-01 13:14:30.000000000 +0200 +@@ -74,6 +74,7 @@ + static GBool level2Sep = gFalse; + static GBool level3 = gFalse; + static GBool level3Sep = gFalse; ++static GBool doOrigPageSizes = gFalse; + static GBool doEPS = gFalse; + static GBool doForm = gFalse; + #if OPI_SUPPORT +@@ -115,6 +116,8 @@ + "generate Level 3 PostScript"}, + {"-level3sep", argFlag, &level3Sep, 0, + "generate Level 3 separable PostScript"}, ++ {"-origpagesizes",argFlag, &doOrigPageSizes,0, ++ "conserve original page sizes"}, + {"-eps", argFlag, &doEPS, 0, + "generate Encapsulated PostScript (EPS)"}, + {"-form", argFlag, &doForm, 0, +@@ -202,8 +205,10 @@ + fprintf(stderr, "Error: use only one of the 'level' options.\n"); + exit(1); + } +- if (doEPS && doForm) { +- fprintf(stderr, "Error: use only one of -eps and -form\n"); ++ if ((doOrigPageSizes ? 1 : 0) + ++ (doEPS ? 1 : 0) + ++ (doForm ? 1 : 0) > 1) { ++ fprintf(stderr, "Error: use only one of -origpagesizes, -eps, and -form\n"); + exit(1); + } + if (level1) { +@@ -223,9 +228,10 @@ + fprintf(stderr, "Error: forms are only available with Level 2 output.\n"); + exit(1); + } +- mode = doEPS ? psModeEPS +- : doForm ? psModeForm +- : psModePS; ++ mode = doOrigPageSizes ? psModePSOrigPageSizes ++ : doEPS ? psModeEPS ++ : doForm ? psModeForm ++ : psModePS; + fileName = new GooString(argv[1]); + + // read config file