hanneskod / libmergepdf

PHP library for merging multiple PDFs
391 stars 77 forks source link

FEATURE: add EntryPoint for postPageImport manipulations #21

Closed kaystrobach closed 6 years ago

kaystrobach commented 7 years ago

refactoring https://github.com/hanneskod/libmergepdf/blob/master/src/Merger.php#L152 would make it possible to extend your class more easily, and add custom post processing (e.g. add watermark images, etc.)

So I suggest moving the actual page add operation to a seperated function, which is easier to extend.

This would also raise the readability of the code in the merge function due to less complexity.

hanneskod commented 7 years ago

Sure why not. If you want to write a pull request it would i'll be happy to merge.

kaystrobach commented 7 years ago

Do you prefer it as Hook? Iteration over array of closures / anonymous functions or as simple refactoring with the ability to extend and then overload a single function?

hanneskod commented 7 years ago

Well a simple refactoring is fine with me. But if we really want to advertise this as a feature I guess

public function addProcessor(callable $processor);

is a stronger way to go. If you would be willing to write something like that it would be awsome!

hanneskod commented 6 years ago

Closing as there seems to be no development. Please reopen if this is still requested!