how to convert .docx / .doc file to .pdf using php only -


i want convert ms-word file(.doc,.docx) .pdf or .html file without losing style , image on word file.

                   $filenamearray = explode('.',$filename );                         $doc = new docx_reader();                         $doc->setfile($item);                          if(!$doc->get_errors()) {                             $html = $doc->to_html();                             $plain_text = $doc->to_plain_text();                             $myfile = file_put_contents("$filenamearray[0].html", $html.php_eol , file_append | lock_ex);                          } else {                             echo implode(', ',$doc->get_errors());                         } 

above solution tried giving me html without style , image.i want .html or .pdf same .doc .docx file.

this not easy task , rate of success largely depend on complexity of word document. if basic style elements used (bold, italic, underline, color) use html add on fpdf. more complex complex elements require translation function fpdf.

i assume need template purposes, may suggest directly programming page layout in fpdf. can create custom tags layout can used in wysiwyg editor.

you lose of flexibility compaired word document, loss not outweight ease of setting standard fpdf. again, best way t o go depend on functionality need , end-goal. suggest taking @ possibilities fpdf. it's great script , can make pdf's lightning fast!


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -