Hi guys,
Thanx in advance.
I have a problem related to pdf attachment.
We have created a pdf through htmldoc commands.But we are unable to save this PDF?
steps are as follws…
1-The html equivalent code for pdf has been created in a view file /protected/advert/voucher_pdf.php
2-Another view file is executing the htmldoc commands for PDF conversion for that code is as follows…
<?php
$filename=$_REQUEST[‘filename’];
$voucherid=$_REQUEST[‘iid’];
$filename=$_REQUEST['filename'];
$voucherid=$_REQUEST['iid'];
//$id='9317591704252';
$flink='http://'.$_SERVER['HTTP_HOST'].'/basket/'.$filename.'/'.$voucherid;
function topdf($filename, $options = "")
{
# Write the content type to the client...
ob_start();
header('Pragma:public');
header('Expires:0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: public');
header("Content-Type: application/pdf");
flush();
# Run HTMLDOC to provide the PDF file to the user...
passthru("htmldoc -t pdf --quiet --jpeg --webpage $options '$filename'");
//echo "htmldoc -t pdf --quiet --jpeg --webpage $options '$filename'";
//exit;
}
//echo $flink;
//topdf($flink,"--landscape --footer /ld --left 0.5in --linkcolor '#0000ff' --bodyfont 'helvetica' --textfont 'helvetica' --textcolor '#636163' --headfootfont 'helvetica' --headfootsize '8' --top 0.5in");
topdf($flink,"--portrait --left 0.1in --right 0.1in --linkcolor '#0000ff' --bodyfont 'helvetica' --textfont 'helvetica' --textcolor '#636163' --headfootfont 'helvetica' --headfootsize '8' --top 0.2in --charset 'UTF-8' --fontspacing '1' --pagelayout 'single' --size 11x11.69in ");
exit;
//$id=‘9317591704252’;
$flink=‘http://’.$_SERVER[‘HTTP_HOST’].’/basket/’.$filename.’/’.$voucherid;
function topdf($filename, $options = "")
{
# Write the content type to the client...
ob_start();
header('Pragma:public');
header('Expires:0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: public');
header("Content-Type: application/pdf");
flush();
# Run HTMLDOC to provide the PDF file to the user...
passthru(“htmldoc -t pdf --quiet --jpeg --webpage $options ‘$filename’”);
//echo “htmldoc -t pdf --quiet --jpeg --webpage $options ‘$filename’”;
//exit;
}
//echo $flink;
//topdf($flink,"–landscape --footer /ld --left 0.5in --linkcolor ‘#0000ff’ --bodyfont ‘helvetica’ --textfont ‘helvetica’ --textcolor ‘#636163’ --headfootfont ‘helvetica’ --headfootsize ‘8’ --top 0.5in");
topdf($flink,"–portrait --left 0.1in --right 0.1in --linkcolor ‘#0000ff’ --bodyfont ‘helvetica’ --textfont ‘helvetica’ --textcolor ‘#636163’ --headfootfont ‘helvetica’ --headfootsize ‘8’ --top 0.2in --charset ‘UTF-8’ --fontspacing ‘1’ --pagelayout ‘single’ --size 11x11.69in ");
exit;
3-This code is generating pdf for us but how to save this pdf doc??please help??
4- we tried this command
[html]htmldoc -f http://wikiwin.avalonnet.be/voucherpdfs/ http://wikiwin.avalonnet.be/basket/voucherprinttopdf?filename=voucherdetails_pdf&iid=5419990076961 --webpage[/html]
in view files but it is not working