Any other suggestions? (Preferably constructive. ;-) )
TIA!
PDF will be much easier than Word format, because Word format is closed
and proprietary, very complex, and not fully understood. Thanks, Bill!
As to PDF: PDFlib (http://www.pdflib.com) supports all features of PDF.
I'm not sure if the free PDFlib Lite does that, but the full version is
only 450$, so if it's for a client, that should be fittable in most
budgets. For fancier work I suggest the PDFlib Personalization Server.
It's a bit more expensive, but it allows you to create the PDF files in
any app and then put placeholders in them. Then you can import the PDF
from your PHP app, fill in the placeholders with DB or form data and
present a perfect PDF file to print. With the PSP addon you can even
encrypt it against tampering.
(I'm not affiliated with PDFlib in any way. I just used it for a project
and was very happy with it.)
Jochen
--
/**
* @author Jochen Buennagel <zang at buennagel dot com>
*/
> Has anyone found a way to generate a Word .doc on the fly using PHP on
> a Linux server? Are there any libraries out there that support this?
> I would use PDF, but none of the libraries seem to support Acrobat
> forms. A client needs to generate a partially filled out form using
> data from a MySQL table that an applicant will receive via email to
> complete, print, sign and snail mail.
Hi Tyrone,
Another (easy) option is creating a normal html form in a MIME email and
adding the content type header for a Word document (as MS Word renders
HTML): Content-type: application/x-ms-word
Test it with a browser:
<?php
header("Content-type: application/x-ms-word");
?>
<form>
Name:<br>
<input type="text" name="fullname" value="John Doe"><br><br>
</form>
HTH;
JOn
There is a way but it is not right for a 'good programmer'...
If the file size,formating,fonts,colors is always the same....
You can make a template document in MS Word and replace
the template text treating it like the common text file. But again, you
should know that it's a wrong way :)
"Tyrone Slothrop" <t...@paranoids.com>
Kindest Regards,
Olexiy Merenkov
http://www.merenkov.com/olexiy/
Unfortunately I am not able to give my opinion on it yet, because I still
have to try it out. At least it is already stated at the FPDF website that
it is slower than PDFLib, but that is not a problem for me. The
compatibility problems between PDFLib versions and PHP versions bothers me
more (I upgraded to PHP 4.3.2 and started using the GD2 library instead of
using GD with PHP patch and now my PDFLib PDI functionality is suddenly no
longer part of my license; When moving to PHP 5 I will even have to by a
whole new PDFLib license).
Does anybody else have experience with FPDF?
Greetz,
Ovide
"Jochen Buennagel" <za...@buennagel.com> wrote in message
news:bihkgh$sqk$01$1...@news.t-online.com...
Martin
Andres
Creating a word document would probably be impossible owing to
its closed binary nature. But it's possible to generate
Rich-Text (.rtf) documents with PHP, these could then be named
with a .doc extension, sent with the MS-Word MIME type and Word
would open them happily.
Link: http://www.paggard.com/projects/rtf.generator/
And a basic tutorial in the Rich-Text format:
http://www.php9.com/index.php/section/articles/name/Using%20PHP%20for%20Rich%20Text%20Format%20RTF
--
There is no signature.....
You're "BEST" bet is get a word doucment going, save as HTML, then take the
gerated HTML document as a template, add some of the code below to re-import
it into MS Word, and go from there. MS Word is really picky... one small
change can spiral your config outta control, so save frequently.
Good luck..
<?
header("Content-type: application/msword");
header("Content-Disposition: attachment; filename=" . $resume_name .
".doc");
echo '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<title></title>
</head>
';
echo "<!--[if gte mso 9]>
<xml>
<o:DocumentProperties>
<o:Author>" . $this->Author . "</o:Author>
<o:LastAuthor>" . $this->LastAuthor . "</o:LastAuthor>
<o:Revision>" . $this->Revisions . "</o:Revision>
<o:TotalTime>" . $this->TotalTime . "</o:TotalTime>
<o:Created>" . $this->CreateDate . "</o:Created>
<o:LastSaved>" . $this->LastSaveDate . "</o:LastSaved>
<o:Pages>" . $this->Pages . "</o:Pages>
<o:Company>" . $this->Company . "</o:Company>
<o:Lines>" . $this->Lines . "</o:Lines>
<o:Paragraphs>" . $this->Paragraphs . "</o:Paragraphs>
<o:Version>" . $this->Version . "</o:Version>
</o:DocumentProperties>
</xml>
<![endif]-->
<!--[if gte mso 9]>
<xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml>
<![endif]-->";
?>
--
Roy Rico
Halo 8 Productions
Mobile: 602 / 315.1438
http://www.halo8productions.net/
"Tyrone Slothrop" <t...@paranoids.com> wrote in message
news:822okvo65l5gvchpb...@4ax.com...
Great! Seems to be a nice hack. Would be nice if you add this
stuff at php.net/header
AFAIK, this "templating" logic is not true for Word DOC, it's true
only for rtf. BTW, rtf created out of Word Pad is less in size and
looks better as compared to the rtf created out of MS Word.