Skip to content

Support for merging a page in the background (watermark) #307

@hvbtup

Description

@hvbtup

I propose adding an optional argument background=False to the various merge...Page methods.
All these methods finally go into _mergePage. There, the following little change should to the trick:

    newContentArray = ArrayObject()

    originalContent = self.getContents()
    if originalContent is not None:
        newContentArray.append(PageObject._pushPopGS(
              originalContent, self.pdf))

    page2Content = page2.getContents()
    if page2Content is not None:
        if page2transformation is not None:
            page2Content = page2transformation(page2Content)
        page2Content = PageObject._contentStreamRename(
            page2Content, rename, self.pdf)
        page2Content = PageObject._pushPopGS(page2Content, self.pdf)
        if background:
            newContentArray.insert(0, page2Content)
        else:
            newContentArray.append(page2Content)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions