[Python] How can I arbitarily rotate, rearrange etc pdf pages in Python?

Discussão em 'Python' iniciado por Stack, Maio 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have an input.pdf which is "normal" (a number of pages all the same orientation and direction) and I want to create a new pdf which can arbitrarily rearrange the input pages

    For example:

    [​IMG]

    I only need rotation and scaling. Each input page will be present in its entirety as some component of the output. I don't need to fiddle with text, colours, cropping, etc.

    In pseudocode these are all the features I need:

    in = open_pdf("input.pdf")
    out = new_pdf ()

    p = createpage (size)
    p.add (in.get_page(123), origin=(0,100), scale=(0.5,0.5), angle=degrees(270))
    p.add (...)

    out.add(p)

    out.save("output.pdf")


    Can I do this in Python?

    If not Python, some other linux-friendly scripting language?

    Continue reading...

Compartilhe esta Página