Export from tinymce to pdf/docx - php

I use the tinyMCE editor, I save its data with mysql, in html from what I can see.
How can I export this data of my users to pdf and docx with php (serverside) ?
I believe the free edition of phpDocx lacks that functionality (embedHTML function missing)
Is there an alternative ?

You should write your html code to a html file serverside and use a library like this one to create a pdf file.

Related

Opening HTML as Word or PDF using PHP/Laravel

I'm a little confused about PHPWord w/ DomPDF. If I generate HTML using Laravel/PHP/Blade, store it in a text file saving it with .html extension, and open it with Word (open Word, select File open, etc), I see the page as I would like to see it in Word.
But if I use PHPWord to write the HTML to a file and then open it as Word2007 for download, PHPWord strips out all the CSS etc. And it looks horrible.
Also while dompdf with the help of PHPWord (again writing the HTML to a file and being read as PDF) the PDF looks much better than the generated Word version but still has no styling.
I have reviewed the samples for each . . . all the articles I can find on here etc. Is there another way to do what I do manually--open the html in Word--for a download with PHP?
I cannot recode the blade template with the PHPWord tagging. But if the Windows laptop Word app can open my HTML and save it as a Word file just fine I would think I could do this relatively easily with PHP programmatically somehow.

Print Highcharts in pdf format

Is it possible to Print the highchart as a PDF using DOMPDF or any other PHP Html pdf generators?
Version 2 of Highcharts includes PDF generation. The Highcharts client side will export an SVG string, and there will be server modules based on Batik that do the conversion to PDF. You can try it out at Link.
This component will only convert the chart itself. If you want to convert the whole webpage or parts of it, check out the server library with the name of wkhtmltopdf (read WebKit HTML to PDF). It converts the charts too.
Take a look at their latest announcement about generating images on the server.
Once you save the images, you can add them to a pdf using libraries such as tcpdf
Please familiarise yourself with the included exporing module and parameters which can be used http://api.highcharts.com/highcharts#exporting

PHP export to excel with styles

I'm using code from http://forums.codeguru.com/archive/index.php/t-470940.html to create excel in php. Is there a way to add styles like bold and/or italic to cells when doing it that way? Thank you
The method shown in that thread does not generate an Excel .xls file. It generates a tab-separated-value file. This is a plain text format, that does not support styling of any kind
If you want to generate a real xls file with formatting, then look at some of the libraries that can be used from PHP to write actual Excel files such as my PHPExcel library
EDIT
In addition to PHPExcel, you can find details of other PHP libraries for writing real Excel files in the answer to this question

PHP Html to DOC , XLS and ODF convertor

Hi everybody
I'm using CKeditor to edit and generate some reports for my php project. But I need to export the edited texts from CkEditor to Open office and Microsoft word format. So what I need is a class or component which has a function like these :converttoodf($htmlcode) converttodoc($htmlcodes) which return odf and doc format.
However, The doc and Odf file should be without problem , and the pictures and tables should be shown nicely.
In addition, No matter if yr solution be commercial, I may buy it cause I really need it urgently
Tnx in advance and hope can get the right answer asap , here
XLS:
http://docraptor.com/ (automatic conversion from HTML)
or
http://phpexcel.codeplex.com/ (manual building of file, just like phpword from another answer)
DOC
You can get away with just saving the HTML with inline css styles applied and saving it as a .doc. Not sure about how to display images there though.
ODT
http://incubator.apache.org/zetacomponents/documentation/trunk/Document/tutorial.html
more info: http://www.slideshare.net/tobyS/presentation-5028656
You might want to take a look at phpword... i know it supports html documents but im not sure if you can jsut load some source and save it out - you may have to build the document programatically.
If you need ODT anyway, then I'd recommend using OpenOffice via commandline. There is http://www.artofsolving.com/opensource/pyodconverter which can convert between pretty much all Office formats.
HTML import shouldn't be a problem. Don't be foiled by the PDF example. Input and output formats can vary. http://www.oooninja.com/2008/02/batch-command-line-file-conversion-with.html

Read and write rich text files from TinyMCE in php

I am making a file uploader and editer in PHP using the TinyMCE rich text editor.
Which all files/types can be edited in TinyMCE.
Whats best was to edit a server file in TinyMCE.
How do i save to file edited in TinyMCe and what format should i save.
Sample code will be helpful.
In case tinymce is not right editor, please just another open source rich text editor.
TinyMCE is just a WYSIWYG editor which means that it cannot read or write content to files, but it can interpret html to visual texts.
You can exchange html between TinyMCE and you php code then write it as you want into files.
You can use some APIS to convert your files content into HTML to read it, these are some links to read write MS Word Content
How can I display Word documents in a textarea using PHP?
Create Word Document using PHP in Linux
Regards
NiL

Categories