Programmatically formatting HTML in Eclipse workspace - html

I like Eclipse's HTML formatter. It is the best formatter I have seen and I want to use it programmatically. Is it possible? And how?
Thank you greg-449, but your advice is too difficult for me.
I have an lxml based XHTML-to-XHTML converter. I am using it mainly from PyDev. Its output is not so much human-readable and that is not what I want.
I know several ways to format XHTML. And I like Eclipse's formatter the best.

eclipse's html formatter class is org.eclipse.wst.html.core.internal.format.HTMLFormatter
you can get the source code and remove dependencies to other eclipse libraries in the class and use it...
you can find the source from here (and some other places)

Related

Static typing in html for angular in Visual Studio

Is there any way to check if html is valid and to have some intellisense? I mean I need something like typescript, but for html. For example I would like to get compilation errors when I use directives which are not exists. Or properties of scope what are not declared (in case of TS).
update:
I basically need kinda tsx for angular. And it's already addressed here https://github.com/Microsoft/TypeScript/issues/6508
I would strongly suggest you to use WebStorm which is a smart coding assistance for JavaScript and compiled-to-JavaScript languages, Node.js, HTML and CSS.
One of the best for Angular.
It has free 30-day trial and you can download it from the link below:
https://www.jetbrains.com/webstorm/

I have created an html generating js function based on JSON. Is this more effective than templating engines or doing it manually by code?

Could you please check if this function is more effective from a coding point of view than templating engines or manually creating the html elements through code?
https://github.com/krishnakumar-m/simple-html-templating-json
I have checked github for use of JSON to generate HTML. But was not able to find any. I found this a bit more handy while dynamically generating html elements, because I was able to visualize the HTML as JSON.
Why are we not using JSON for structuring HTML this way? Is there a catch here? Or are there libraries which does the same thing?

Convert a HTML file to Image in C++ apart from 'wkhtmltoimage'

I need to convert a local HTML file to a Jpeg Image in a C++ module. As per our requirement, I cannot use 'wkhtmltoimage'. Hence I need any command line tool or libraries( which can be used in C++ ) that are available for the same.
Any suggestion will be appreciated.
ImageMagick is able to convert HTML to images (by first converting the HTML into PostScript and then to an image), however it's definitely not the best solution. WebKit is really the best tool for the job here. I don't know all the details about your situation, but maybe try linking to WebKit and using it directly instead of invoking wkhtmltoimage?

Beautifying HTML with JSP mixed in

Does anyone know of an HTML beautifier that can deal with (or at least ignore) JSP? I've searched high and low... I'm not looking for an HTML validator, just something that can format the file decently (i.e. indentation).
Most good IDE's will let you say which code template to use as default within another file extension.
So i use PHPstorm in which i can say, for example that a *.jsp will use html first and then jsp. This way the page will display and reformat my code with the correct spacings and what not.
Worth looking into which IDE you are using, assuming you're using one :)

How do I convert PDF to HTML programmatically?

Are there any classes, COM objects, command line utilities, or anything else that I can make an API for that can convert a PDF to an HTML document? Obviously the conversion might be a little rough since PDFs can contain a lot more than HTML can describe. I found a utility called pdftohtml on Source Forge, but quite honestly it does a horrible job with the conversion. I don't care if the software is free or commercial, but is there anything out there at all that I can incorporate with my own software to do this sort of conversion at least decently? I know Google's developed their own method of doing this, since you can click "View as HTML" on a PDF attached to an email through Gmail, but I was hoping there was something out available to the public.
Remember, PDF to HTML. I'm NOT worried about HTML to PDF.
well one solution i can think of is to write little program that reads pdf text using library called iText and then generate html files.
well for java based PDF solutions...we dont have a clean way i guess-still.. all solutions are primitive and kind of workarounds... No easy solution for
1. Designing a template of a PDF
2. Then at runtime using java, populate data into this template...either using xml or other datasources...
such a simple requirement and NONE has a good "open-source and free" solution yet !
Eclipse BIRT comes close.. but does not handle Barcode elements ..OOB.
You were looking for pdf2htmlEX (C++), which converts PDF to HTML without losing text or format.
To convert further to semantic HTML, you can process pdf2htmlEX output using my project Transcript (Python). It is however not lossless anymore and works best on documents not deviating too much from conventional visual layout.