Re: Write a PDF file for an HTML file

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

 



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
>


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

  Powered by Linux