Home  >  Article  >  Backend Development  >  PHP converts html to rtf format_PHP tutorial

PHP converts html to rtf format_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:27:561005browse

Preliminary preparations: Download Html2Rtf.dll, run cmd as administrator, enter the directory where Html2Rtf.dll is located -> Enter Regsvr32 Html2Rtf.dll

Core code:

PreserveImages = true;

 $html2RTFCom->PageNumbers = 1;

 $html2RTFCom->PageNumbersAlignH = 1;

 $html2RTFCom->PageNumbersAlignV = 5;

 $htmlFile = "a.html";

 $rtfFile = "a.rtf";

$result =$html2RTFCom->ConvertFile($htmlFile,$rtfFile, "head", "foot");

print($result);

unset($html2RTFCom);

echo "done";

 ?>

Possible problems Fatal error: Class 'COM' not found in ×××

Solution:

·Copy php_com_dotnet.dll to the ext folder in the php root directory

·php.ini Make sure to have this statement

 [PHP_COM_DOTNET]

extension=php_com_dotnet.dll

·Ensure that the COM+ Event System service is turned on

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/814675.htmlTechArticlePreparatory work Download Html2Rtf.dll, run cmd as an administrator, and enter the directory where Html2Rtf.dll is located-- 》Enter Regsvr32 Html2Rtf.dll core code: PreserveImages = true; $html...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn