Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Embeding into PDF - Unique String

I need to embed a unique string into a pdf document

8:08 pm on Apr 8, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 8, 2008
votes: 0


I have a client who sells his e-book via a paypal interface.

The client is very concerned about the security of his e-book.

I have set him up an awesome file serving system that serves the file sercurely after paypal.. but now my client is asking if I can put some form of tracking system in the pdf.

So when someone downloads the pdf, I need to put something
(probabbly an md5 of the purchaser's email)
in the pdf, so that if a copy of the pdf does leak out to the public,
We can trace it to the purchaser.

How can i go about this without blowing up the file.

Ive looked into PDFlib.. and after some reading, they will put their watermark on my pdf unless I purchase a 2000$ key.....

FPDF also looked like it might do what i need, if i use the FPDI extension.

Has anyone here has any experience with these?
Is there a simpler way to acheive this, then trying to use this new class?

8:27 pm on Apr 8, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 31, 2006
votes: 0

Hey gcarn,

I've done exactly what you need for free using FPDF and the FPDI extension you mentioned. It took awhile to find the solution, and some playing to get the values just right, but it works great. I sell an ebook on one of my sites, and when someone does the purchase my script licenses and watermarks each page of the ebook at download time with a dynamic serial number consisting of things like time and PayPal Transaction ID numbers.

The trick is to do it page by page and rebuild the pdf file from scratch. The way the FPDI extension works, I believe, is that it takes a snapshot of what a page of an existing pdf looks like. You can then use FPDF to write a string on top of that snapshot. Loop through every page in your ebook, building the download as you go, and then offer it up via the script using pdf headers.

Works like a charm, and you can use the serial number to track when and who downloaded if you ever find a copy floating around.

11:18 am on Apr 9, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 8, 2008
votes: 0

cool, it looks like ive got my work set for today
Hopefully i can make my way through FPDF and FPDI to figure out exactly how to go about it.. now that i know it can be done with those tools :D

Thanks dusk!


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members