"Can not buid tree with empty xml" getting error using html2ps in cakephp 2.3.8

StackOverflow https://stackoverflow.com/questions/18266851

  •  24-06-2022
  •  | 
  •  

문제

I got this error when tried to download a PDF. It seems the code expect xml string to echo something to the screen before the PDF created.

enter image description here

Did I miss something in my setup? I have followed the steps explained by this website http://bakery.cakephp.org/articles/Casmo/2010/06/26/creating-pdf-files-with-html2ps-html2pdf.

도움이 되었습니까?

해결책

Hi Pankaj,

Cakephp2.3.x the folder name get changed "vendor" to "Vendor". that is why you are getting the error..

Cakephp 1.3.X : In PdfComponent we are using

// Include the class file and create Html2ps instance

  App::import('vendor', 'Html2PsConfig', array('file' => 'html2ps'.DS.'config.inc.php')); 
  App::import('vendor', 'Html2Ps', array('file' => 'html2ps'.DS.'pipeline.factory.class.php'));
  parse_config_file(APP .'vendors'. DS .'html2ps'. DS .'html2ps.config'); 

Cakephp 2.3.X : In PdfComponent you have to change the code same as bellow..

// Include the class file and create Html2ps instance

  App::import('Vendor', 'Html2PsConfig', array('file' => 'html2ps'.DS.'config.inc.php')); 
  App::import('Vendor', 'Html2Ps', array('file' => 'html2ps'.DS.'pipeline.factory.class.php'));
  parse_config_file(APP .'Vendor'. DS .'html2ps'. DS .'html2ps.config'); 

Try this may helpful for you.. :-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top