convert rich html with css classes and background image to PDF - wkhtmltopdf

I need to convert html which include css classes based on css file(s).The HTML also has images as background (css class that has background-image as property). It uses css3 properties and models (i.e.- flexbox).
I'm just at the begining of my search, but few names came along:
wkhtmltopdf
Pechkin
itextsharp
phantom.js
HtmlToPDF
I had some experience with iTextSharp but not with a rich html as mentioned.
I'm looking for a tool that can convert that kind of HTML to a PDF.
Can be done using .net->C# - (prefered) or node.js, but not PHP.
Thanks in advance

I've made some investigation, the most problematic issue was css3 properties (flex box model) which were not converted as it should be to the PDF -see details below.
More than this - when using background-image - I set the background-image property with base64 code of the image as the url (there are online converters png <-> base64).
Below are some of the converters I've investigated:
pdfcrowd - the best .net api I've found. Worked well with the flexbox. The problem is that it is not for free for long-term.
HtmlRenderer.PdfSharp - C# converter - seems like not able to parse well the flex-box.
Pechkin is a .NET Wrapper for wkhtmltopdf DLL (command line tool) - also - couldn't parse flex-box well.
html-pdf - node.js package that uses phantomjs - worked well for me with the flex-box model with minor changes.
There are few other wrappers for the phantomjs which should work.

Related

Generating pdf of web page in laravel

I want to generate a pdf of a form that a user fills and download it to the users computer.
I tried using the Dompdf package from laravel to do this and everything works fine except the design. The generated pdf does not look exactly like the web page, after doing some searching about this issue, I found out that dompdf does not support a few of the css option.
I was wondering whether there are any other free packages like dompdf that I could use which can have rich styling and convert the web page to pdf with the exact design.

Is there a built-in markdown flavor for Firefox?

I like to use markdown languages like GitHub markdown and ASCIIDoc to provide lightweight formatting to text documents. The tags in HTML are too heavy and render the original text almost unreadable.
The problem is when I send documents to other users. They can't be bothered with installing a markdown plugin. I would like to use a markdown flavor that will render predictably in web browsers. That way I can send a URL for my document and the recipient will see the formatted text.
Is there a standard markdown language built into Firefox?
Thanks,
(PS: this is a serious question. Pedants please restrain yourselves.)
Unfortunately, at the moment, there are no major web browsers that natively support parsing and rendering markdown.
However, there are a few solutions.
Render the markdown to html and send the html document. Most renderers automatically include Stylesheets that make the html look good, or you can edit the output or templates yourself.
Get the recepent to install a extension that will render the markdown. I quickly found something by googling firefox markdown extension.
I hope this solved your problem.

Replace image in bitmap image object without opening document in word 2007 (any language)

I have a word 2007 document that is being used here as a template. In this template there are some bitmap image objects that are currently blank. The task is to write some text on these images.
The manual way is to edit the document and using paint I write the text on each of these images. But I am looking for a more dynamic way. Anything that can help me achieve my purpose.
I tried to do it using PHP but failed. PHPWord: Replaced image doesn't gets actually replaced
You can try DocxTemplater, which is a Javascript Library I maintain:
http://javascript-ninja.fr/docxgenjs/examples/demo.html#images
You can do that in the browser, but it works only in modern browsers (Chrome, FF, Safari latest versions). I recommend you to use nodejs.
Github Repository: https://github.com/edi9999/docxtemplater

CKEditor - have it return markdown syntax instead of HTML

I'm working on a CMS platform and I am planning to use CKEditor as it seems to offer everything I need.
One thing that is a bit of a bother to me is that I want my content to be in markdown format instead of html and while I found a BBCode extension for this, I couldn't figure out how it can be remade to support markdown.
I tried to find an editor that does markdown out of the box, but the ones I found are way too simple for what I need and CKEditor has the benefit of having a plugin system to adjust perfectly for me.
CKEditor now has a Markdown addon that does this exact thing. The addon project is hosted on github.
Screenshots:
See also: Integrated Markdown WYSIWYG text editor (2012)
Using Markdown instead of HTML is a very bad idea for several reasons:
Markdown has no spec, so every library works differently in details. The output which you'll produce using CKEditor may give a different (even totally wrong) result when transformed to HTML by your back-end. For example - escaping image's title and link texts - you won't be able to ensure that the text user inserted does not break the output.
Not all HTML can be transformed to Markdown.
There are plenty of tricky cases which are totally correct in HTML, but cannot be done in Markdown.
Markdown has fewer features than HTML, so you'd lose some content which users produced.
You actually gain nothing by using Markdown instead of HTML.
I am a CKEditor core developer, so I know it very well. I tried to implement a Markdown writer for CKEditor and very quickly I found that it's completely pointless. I don't say that it's not possible, because it is, but only a limited stability can be achieved - too low for anything I would personally want to use in production.

How do I use css and stylesheets with ITextSharp 4

I'm exporting an html view to pdf, how can i get it to recognise css styles? mostly colors, table borders, font sizes, nothing too hectic.
See this post. Support for HTML and CSS is getting better with each version but its still no where near full HTML & CSS support. For instance, I don't believe that HTML classes and ID are supported yet, you can only style tags in general. This is on the iText roadmap but I don't know when they expect to be completed.

Resources