Re: Write a PDF file for an HTML file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I just seen your post. This seems you are doing some explicit work to convert the html code to a format that can be later used to write a pdf. 
 
Can you please send me the complete class you have used along with an example you have done?
 
Thanks

--- On Thu, 4/2/09, nickmarinho@xxxxxxxxxxxx <nickmarinho@xxxxxxxxxxxx> wrote:


From: nickmarinho@xxxxxxxxxxxx <nickmarinho@xxxxxxxxxxxx>
Subject: Re:  Write a PDF file for an HTML file
To: php-objects@xxxxxxxxxxxxxxx
Date: Thursday, April 2, 2009, 8:21 AM






Here is one that i use to convert html tags to fpdf:

function WriteHTML($html) {
$html=str_replace( "\n",' ',$html);
$a=preg_split( '/<(.*)>/ U',$html, -1,PREG_SPLIT_ DELIM_CAPTURE) ;

foreach($a as $i=>$e){
if($i%2==0){
if($this->HREF) $this->PutLink( $this->HREF, $e);
else $this->Write( 5,$e);
}
else{
if($e{0}=='/ ') 
$this->CloseTag( strtoupper( substr($e, 1)));
else{
$a2=explode( ' ',$e);
$tag=strtoupper( array_shift( $a2));
$attr=array( );
foreach($a2 as $v)
if(ereg('^([ ^=]*)=["\ ']?([^"\' ]*)["\']? $',$v,$a3) )
$attr[strtoupper( $a3[1])]= $a3[2];
$this->OpenTag( $tag,$attr) ;
}
}
}
}

Softmasters wrote:
>
> Dear All,
> 
> I have template for the report to printed and emailed to each client. 
> I have reached at the point where I have the html text for the whole 
> report in a string object. Now I want to write a pdf for this html code.
> 
> Please suggest me the BEST php script (php class) that I can use to 
> generate good pdfs. I know there are a lot of such scripts available 
> but which one is best (developers) can suggest.
> 
> Waiting for your reply
> Thanks
>

















      

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux