Wednesday 18 November 2020

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

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:

enter image description here

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?



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

No comments:

Post a Comment