--- C:/svn/modules/reporting/trunk/lrs_lra/3rdParty/generic/patched/pdf.py Di Dez 6 10:39:40 2016 +++ C:/svn/modules/reporting/trunk/lrs_lra/3rdParty/generic/patched/orig.py Mi Mai 18 18:47:24 2016 @@ -34,8 +34,6 @@ """ A pure-Python PDF library with an increasing number of capabilities. See README for links to FAQ, documentation, homepage, etc. - -Patched by H. von Bargen to support the background argument in the various mergePage methods. """ __author__ = "Mathieu Fenniak" @@ -2227,7 +2225,7 @@ else: return None - def mergePage(self, page2, background=False): + def mergePage(self, page2): """ Merges the content streams of two pages into one. Resource references (i.e. fonts) are maintained from both pages. The mediabox/cropbox/etc @@ -2238,9 +2236,9 @@ :param PageObject page2: The page to be merged into this one. Should be an instance of :class:`PageObject`. """ - self._mergePage(page2, background=background) + self._mergePage(page2) - def _mergePage(self, page2, page2transformation=None, ctm=None, expand=False, background=False): + def _mergePage(self, page2, page2transformation=None, ctm=None, expand=False): # First we work on merging the resource dictionaries. This allows us # to find out what symbols in the content streams we might need to # rename. @@ -2285,10 +2283,7 @@ page2Content = PageObject._contentStreamRename( page2Content, rename, self.pdf) page2Content = PageObject._pushPopGS(page2Content, self.pdf) - if background: - newContentArray.insert(0, page2Content) - else: - newContentArray.append(page2Content) + newContentArray.append(page2Content) # if expanding the page to fit a new page, calculate the new media box size if expand: @@ -2317,7 +2312,7 @@ self[NameObject('/Resources')] = newResources self[NameObject('/Annots')] = newAnnots - def mergeTransformedPage(self, page2, ctm, expand=False, background=False): + def mergeTransformedPage(self, page2, ctm, expand=False): """ This is similar to mergePage, but a transformation matrix is applied to the merged stream. @@ -2330,9 +2325,9 @@ of the page to be merged. """ self._mergePage(page2, lambda page2Content: - PageObject._addTransformationMatrix(page2Content, page2.pdf, ctm), ctm, expand, background=background) + PageObject._addTransformationMatrix(page2Content, page2.pdf, ctm), ctm, expand) - def mergeScaledPage(self, page2, scale, expand=False, background=False): + def mergeScaledPage(self, page2, scale, expand=False): """ This is similar to mergePage, but the stream to be merged is scaled by appling a transformation matrix. @@ -2346,9 +2341,9 @@ # CTM to scale : [ sx 0 0 sy 0 0 ] return self.mergeTransformedPage(page2, [scale, 0, 0, scale, - 0, 0], expand, , background=background) + 0, 0], expand) - def mergeRotatedPage(self, page2, rotation, expand=False, background=False): + def mergeRotatedPage(self, page2, rotation, expand=False): """ This is similar to mergePage, but the stream to be merged is rotated by appling a transformation matrix. @@ -2363,9 +2358,9 @@ return self.mergeTransformedPage(page2, [math.cos(rotation), math.sin(rotation), -math.sin(rotation), math.cos(rotation), - 0, 0], expand, background=background) + 0, 0], expand) - def mergeTranslatedPage(self, page2, tx, ty, expand=False, background=False): + def mergeTranslatedPage(self, page2, tx, ty, expand=False): """ This is similar to mergePage, but the stream to be merged is translated by appling a transformation matrix. @@ -2379,9 +2374,9 @@ """ return self.mergeTransformedPage(page2, [1, 0, 0, 1, - tx, ty], expand, background=background) + tx, ty], expand) - def mergeRotatedTranslatedPage(self, page2, rotation, tx, ty, expand=False, background=False): + def mergeRotatedTranslatedPage(self, page2, rotation, tx, ty, expand=False): """ This is similar to mergePage, but the stream to be merged is rotated and translated by appling a transformation matrix. @@ -2410,9 +2405,9 @@ return self.mergeTransformedPage(page2, [ctm[0][0], ctm[0][1], ctm[1][0], ctm[1][1], - ctm[2][0], ctm[2][1]], expand, background=background) + ctm[2][0], ctm[2][1]], expand) - def mergeRotatedScaledPage(self, page2, rotation, scale, expand=False, background=False): + def mergeRotatedScaledPage(self, page2, rotation, scale, expand=False): """ This is similar to mergePage, but the stream to be merged is rotated and scaled by appling a transformation matrix. @@ -2436,9 +2431,9 @@ return self.mergeTransformedPage(page2, [ctm[0][0], ctm[0][1], ctm[1][0], ctm[1][1], - ctm[2][0], ctm[2][1]], expand, background=background) + ctm[2][0], ctm[2][1]], expand) - def mergeScaledTranslatedPage(self, page2, scale, tx, ty, expand=False, background=False): + def mergeScaledTranslatedPage(self, page2, scale, tx, ty, expand=False): """ This is similar to mergePage, but the stream to be merged is translated and scaled by appling a transformation matrix. @@ -2462,9 +2457,9 @@ return self.mergeTransformedPage(page2, [ctm[0][0], ctm[0][1], ctm[1][0], ctm[1][1], - ctm[2][0], ctm[2][1]], expand, background=background) + ctm[2][0], ctm[2][1]], expand) - def mergeRotatedScaledTranslatedPage(self, page2, rotation, scale, tx, ty, expand=False, background=False): + def mergeRotatedScaledTranslatedPage(self, page2, rotation, scale, tx, ty, expand=False): """ This is similar to mergePage, but the stream to be merged is translated, rotated and scaled by appling a transformation matrix. @@ -2493,7 +2488,7 @@ return self.mergeTransformedPage(page2, [ctm[0][0], ctm[0][1], ctm[1][0], ctm[1][1], - ctm[2][0], ctm[2][1]], expand, background=background) + ctm[2][0], ctm[2][1]], expand) ## # Applys a transformation matrix the page.