Is there any way to convert ckeditor html content to ms word document? - laravel

I have a Laravel project where I need to create a doc/docx document based on user input in Ckeditor. I have previously worked with PHPword where I can convert simple text input to a docx document. But the problem with ckeditor is it gives you html with inline css (which i need) and PHPWORD can not convert this to a docx.
I also tried to convert the html to word by xml but no luck. I know there is a paid tool called phpdocx but I am looking for a free solution.
Just a note, I can actually convert the html to pdf. But again, there is no solution from pdf to doc.
So, any help in converting the html to word or pdf to word?
thanks

Related

Add logo to title page when backend is docbook

I am trying to customise the title page where the backend output is docbook. title, subtitle etc are all output correctly. But I cannot seem to get the title logo to output.
I have tried:
:title-logo-image: image:images/titleimage.png[]
The only way I can get this to kind-of work is to directly embed the image in the title text. But that is not ideal.
Is this possible when using docbook?
Since you convert AsciiDoc to DocBook I am assuming you are writing a book. The parameter title-logo-image you are using is not for asciidoctor (conversion to HTML and DocBook) but for asciidoctor-pdf (conversion to PDF), see https://docs.asciidoctor.org/pdf-converter/latest/title-page/#logo. If you are okay with PDF instead of DocBook you should try asciidoctor-pdf, it also allows you to customize your page it is pretty nice.
I am not sure what you expect though, is it a big picture on the first page? are you talking about the cover? If so you might want to create your own DocBook cover element and inject it in your DocBook file. This is possible in AsciiDoc by using a DocInfo file. You create a docinfo.dbk file where you write the <cover> element and the file content will then be injected in the <info> Element in the resulting DocBook file.

SpireDoc html to word preserving data tags

I am working on a template generator usecase which involves a tinyMCE editor with the option to export and import to/from Microsoft Word files.
I use SpireDoc to save html files as docx and restore docx back to html.
The problem is, as this is a template generator, I need to include some metadata along some of the html nodes. Say a user's name is inserted in the tinyMCE and the html code would look like this:
<span data-type="user-name" data-id="234">Some Name</span>
Once converted to docx, all the data- tags are stripped off. Is there a way I could tell SpireDoc to preserve those tags and to put them back in the html file when I convert docx back to html?
I know I could resort to ugly placeholders like ##USERNAME|ID## but I would prefer if I could keep my metadata tags because I also need to do that for images and the user will not be able to size/format the image if it was just a text placeholder.

Convert HTML to PDF using TCPDF

I need to convert on the fly an HTML into PDF. I've been using the old HTMLDoc library for a while, but now I need to print SVG graphics and HTMLDoc doesn't support SVG nor base64-enconded images.
So far it seems to me that TCPDF (or a tool based on it) is a good way. The only problem is that I don't want to "build" the PDF document in PHP, as the HTML is dynamic.
Is there any way to write a script that simply takes a portion of HTML page and returns a PDF? That would imply some sort of way to specify start/stop markers in the HTML page (just like in HTMLDoc).
Thanks for any advice,
Thomas
TCPDF has got very limited css support and some bugs with " quotes, so from any html to pdf TCPDF is not an option for you unfortunetly
TCPDF not supports all css functionality, mpdf 6.0 is best ever pdf library for convert html to pdf, It also supports almost required css as well. I prefers htmlcanvas jquery for convert html to image.

convert pdf to html using abcpdf

i am looking for a method to convert a pdf document into corresponding html document using abcpdf. kindly let me know if it is feasible. FYI, My pdf document has rich text along with images.
You can. Try this. Hopefully it'll work.
var doc = new WebSupergoo.ABCpdf10.Doc();
doc.Read('your Pdf byte array');
doc.Save('your HTML file path with .html extension');
doc.Clear();
doc.Dispose();
For documentation please have a look at the note section
http://www.websupergoo.com/helppdfnet/source/5-abcpdf/doc/1-methods/save.htm
To export as XPS, PostScript, DOCX or HTML you need to specify a file path with an appropriate extension - ".xps", ".ps", ".docx", ".htm", ".html" or ".swf". If the file extension is unrecognized then the default PDF format will be used.
You can definitely convert HTML to PDF, but I am not sure the inverse is possible to do with abcpdf.
Perhaps you can give a try to iText (iTextsharp)

How can i convert my html view to pdf document

I am just new in MVC 3. I have a html view which contain all student related data. I just want to convert that view in a pdf document.
You could use iTextSharp to convert html to pdf.
You may take a look at the following article which illustrates how iTextSharp could be used to convert some simple HTML views to PDF by encapsulating the logic into a custom ActionResult. I cannot stress more on the word simple. Don't expect this to work with some complex HTML and CSS rules.
This is a product that I have used in the past, and it has worked out really well (EO.Pdf by EssentialObjects):
http://www.essentialobjects.com/Products/EOPdf/Default.aspx

Resources