mbneto wrote:
Hi,

I have a bunch of M$ WORD documents (rtf and doc) that I'd like to
transform to pdf.

It would simple except that I'd like to allow the user to fill a
couple of variables (name, email, telephone) and replace this before
if generates the pdf.

After searching the net I found some classes but in order to use it
seems that I have to rewrite the entire document and some documents

how do you mean 'rewrite' exactly? if the it takes 3 lines of code but the PDF is generated twice do you really care too much? (maybe you have specific speed/thruput requirements?)

have tables/images.

Any tips ?

maybe you can use COM to create a Word object, load the file add some your vars (possibly inserting them at predetermined bookmarks in the Word file?) and then generate the PDF? (maybe you need to save the new Word file first, depending on what tool you use for the transformation)

alternatively you can open you newly generated pdf file with:

$x = pdf_open_file($pdf, "/path/to/pdf/file");

and then modify the file - maybe add a frontpage with a nice logo
and the information taken from the user given variables - you
wouldn't have to make any changes to the originally generated pages.

http://www.zend.com/zend/spotlight/creatingpdfmay1.php?article=creatingpdfmay1&kind=sl&id=273&open=1&anc=0&view=1
http://nl2.php.net/manual/en/ref.pdf.php

-- it might also be possible to create a template pdf that automatically 
displays
some author/doc metadata; then when you generate the PDF you only need to
add the user given variables as metadata and it will display in the file:

    PDF_set_info($pdf, "author", "John Coggeshall");
    PDF_set_info($pdf, "title", "Zend.com Example");
    PDF_set_info($pdf, "creator", "Zend.com");
    PDF_set_info($pdf, "subject", "Code Gallery  Spotlight");

I'm just guessing that its possible to display an <author> field in the PDF
in similar way to, for Instance, MSWord.


- mb


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to