Important alert: (current site time 8/21/2014 3:40:33 PM EDT)
 

article

Printable Document Generation With PHP

Email
Submitted on: 6/1/2007 7:44:04 AM
By: Chetankumar Digambarrao Akarte  
Level: Intermediate
User Rating: By 12 Users
Compatibility: PHP 4.0, PHP 5.0
Views: 24056
author picture
(About the author)
 
     This article focuses on the document that can be generated using PHP namely Rich Text Format (RTF). Rich Text Format (RTF) is a file type used to transfer formatted text documents between applications, even those that run on different platforms, such as IBM and Macintosh. RTF is a file format that many word processing programs understand; it is often used when a document is created in one word processing program but is expected to be edited in another word processing program. for more details visit at...http://www.techxcel.com and details about article and its update at...http://www.techxcel.com/content/view/12/29/

This article has accompanying files

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				 date("F d, Y"),
		 'place' => 'Nagpur',
 'name' => 'Flint Hancock',
 'language' => 'PHP',
 'grade' => 'A', );
 $new_rtf = modifier($vars, "certificate.rtf");
 $fr = fopen('output.rtf', 'w') ;
 fwrite($fr, $new_rtf);
 fclose($fr);
function modifier($vars, $rftfile) {
 $xchange = array ('\\' => "\\\\",
'{' => "\{",
'}' => "\}");
 $document = file_get_contents($rftfile);
 if(!$document) {
return false;
 }
 foreach($vars as $key=>$value) {
$search = "%%".strtoupper($key)."%%";
foreach($xchange as $orig => $replace) {
$value = str_replace($orig, $replace, $value);
}
$document = str_replace($search, $value, $document);
 }
 return $document;
 }
?>

sucessfully Generated File

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

1/19/2007 4:57:29 AMRizwan Syed

A job very well done. I must appriciate you on doing great work and writing this piece of code. 5G4M
(If this comment was disrespectful, please report it.)

 
3/15/2007 2:57:56 PMMarco Antonio Calvente Nieto

is simple to use an grant result in a very elegant way. Well done. 5 stars for you.
(If this comment was disrespectful, please report it.)

 
5/18/2007 10:35:26 AMBPena

REMARKABLY OUTSTANDING SCRIPT
(If this comment was disrespectful, please report it.)

 
5/31/2007 8:31:12 AMJoaquin Marcher

you're wrong, file_get_contents doesn't exists in php 3 just a lil correction
(If this comment was disrespectful, please report it.)

 
6/1/2007 1:12:25 AMChetankumar Digambarrao Akarte

Thanks Joaquin Marcher to giude me
i made a mistake that file_get_contents only supported by PHP version 4 And greater..
Chetankumar Akarte
http://www.techxcel.com
(If this comment was disrespectful, please report it.)

 
4/29/2009 9:24:55 PMDavid

Great submission. He even included Fopen modes...

Thankyou for the upload. A+++
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.