View Full Version : PHP code library for watermarking an ePub

11-16-2012, 10:06 AM
Hi everyone, hope your friday is going well! ;)

I'm looking for some php code library for watermarking an epub when selling on our internet site. I asked to some programmers and they all told me they were able to do it (automaticly) on a pdf but not on an ePub.

Is anyone here can help me to get a script or code library to make it work automaticly when someone's buying an epub out of my internet site?

Thanks a lot for your help,
Have a good friday (TGIF!!!)

P.S. If I posted in the wrong section, please feel free to move my thread. I didn't know where's the place to post this. Thanks! :)

11-17-2012, 07:40 AM
You might look at this discussion here:

11-17-2012, 04:04 PM
If by "watermark" you just mean "adding a XHTML page with some info about the customer", you can use my python library to add an ex libris, which accepts an XHTML page template, with string placeholders, and pass the customer-dependant information.

(There is also a Calibre plugin, using this library.)

11-19-2012, 04:27 PM
WOW, a big thank you, AlPe, that is really nice!
Hope the programmer will find that usefull, this is really king from you! :)

11-19-2012, 04:34 PM
You are welcome.

Just a warning: as your developer might notice, the OPF/NCX parsing is done with RegEx instead of a full DOM parser --- because, in the original project, I had to deal with some non-compliant EPUBs files. This means that the code might not work properly for your EPUBs. So far, it has worked on anything I tried, but there is no "formal" guarantee for that.