Question

I'm trying to dynamically watermark a pdf file using PHP with Zend_Pdf.

Is there a way to de-layer a PDF file, put something (text, image) between the background and text layer, and then save it?

Is there like a z-index for PDF files?

Any help would be greatly appreciated.

Regards, Paul

Was it helpful?

Solution

There is a type of Z-index but there's nothing that can actually manipulate it pragmatically. I've been trying to do similar for over a month. I've tried: Zend, FPDF, AcroJS, PyPDF, ImageMagick and GhostScript with no luck.

The only way I've been able to add something "under" something else in a PDF is to rebuild it from the bottom up.

Example: I needed to add a photograph under an employee barcode. First I cropped the PDF to the just the barcode (my_crop.py - Python) Then I converted it to tiff copy (imagemagick) Next I added the employee photo to the original PDF (Zend framework) Finally I added the barcode tiff from the first step (Zend framework)

It's not in any way perfect but it's the only thing I could get anywhere near what I wanted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top