0

Please can someone help on how to add a random text into a strategic location in an existing PDF file using PHP? I am using the rand() function to generate the random text/code.

Thanks

olabel
  • 9
  • 4
  • can you show us what you have tried? – Vikram Oct 03 '12 at 13:58
  • @Vikram. I have been able to generate the random code to add in the PDF file. Now I am looking for a way to input/insert this random code each time the user wants to view/print the form. – olabel Oct 03 '12 at 14:09

4 Answers4

1

With this code you will get 32 character random string on each attempt.

$strRandom = md5(microtime());
virenpatel111
  • 201
  • 1
  • 6
0

you can not just insert text into an existing pdf, you need to generate a new pdf for example with phps integrated pdf functions or one of the free available pdf libraries.

ie. PDFlib, wktmltopdf, zendpdf

Andreas Linden
  • 12,489
  • 7
  • 51
  • 67
0

There are pdf parsers for PHP from what I understand. Check this out Is there a PDF parser for PHP?

Bill Karwin said:

Zend_Pdf is part of the Zend Framework. Their manual states:

The Zend_Pdf component is a PDF (Portable Document Format) manipulation engine. It can load, create, modify and save documents. Thus it can help any PHP application dynamically create PDF documents by modifying existing documents or generating new ones from scratch.

Community
  • 1
  • 1
Pablo Jomer
  • 9,870
  • 11
  • 54
  • 102
0

You can generate random text with sha1, md5, uniqid functions. But you must use a pdf controller class.

Eva Dias
  • 1,709
  • 9
  • 36
  • 67
saidOnder
  • 15
  • 6