Thanks for your help.
Your reply was really very helpfull to me.
Even i also think that using PDF library would be more banificiary then COm interface of word. COM interface to word is working fine, if i use it offline. But i am getting the following error while using it onlie. Is it due to the COM Componenets are not installed on the server. How can i check whether it is installed or not?
<?
$content = "Insert Sample Text Here\t\tThis starts a new paragraph line.";
$word= new COM("word.application") or die("Unable to create Word document");
print "Loaded Word, version {$word->Version}\n";
$word->Visible = 0;
$word->Documents->Add();
$word->Selection->PageSetup->LeftMargin = '1"';
$word->Selection->PageSetup->RightMargin = '1"';
$word->Selection->Font->Name = 'Helvetica';
$word->Selection->Font->Size = 15;
$word->Selection->Font->Bold = 1;
$word->Selection->Font->Animation = 2;
$word->Selection->Font->ColorIndex= 11; //wdDarkRed = 13
$word->Selection->TypeText("$content");
$word->Documents[1]->SaveAs("c:\some_tst.doc");
$word->quit();
echo "done";
?>
script is on dinsol.com/vikas/write_doc.php
Even i also tried out the folowing code for creating the PDF file. But i dont got sucess. I am not understanding, where i am wrong?
<?php
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
pdf_setfont($pdf, $font, 10);
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
//pdf_delete($pdf);
echo "<A HREF=getpdf.php>finished</A>";
?>
you can view it at dinsol.com/vikas/create_pdf.php
Thanks.
Vikas Garg
Dinsol.com
http://www.dinsol.com