HTML rendering algorithm [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 months ago.
Improve this question
I am making an e-book reader for the J2ME and I wonder if I could make it render HTML pages. For the moment, I am using some simplified styling of my own.
So, could anyone point me to a good in-depth tutorial or a specification of an open-source HTML engine? Of course, I have some idea about it all, i.e. the main steps involved, the usage of finite-state machines an so forth, but it's not enough.
But why reinvent the wheel, when it's complicated enough? Do you know of any HTML engine written purely in Java, and light enough to be used as a lib in a J2ME project?
P.S. For the J2ME know-hows:
Porting from Java SE to J2ME is not necessarily an issue for me
I am not yet concerned about the inability (or at least unsuitability) of using vector fonts
UPDATE
If you could only point me to a detailed guide about layouting HTML code, I'd be more than grateful! I need to layout some very simple HTML, like text with basic styling, images, divs and tables. That's all.
(I know it's not trivial even though I need simple layouting, that's why I am asking.)

Webkit comes to mind.

I think Firefox uses Gecko Layout engine. Could prove helpful. More here
https://developer.mozilla.org/en/docs/Gecko and
https://wiki.mozilla.org/Gecko:Home_Page and
For some videos http://redivide.com/blog/gecko-reflow-awesome-visualization-of-web-page-layout/

Dear me, I seem to be answering my own question.
The only possibilities that I found are:
J2ME Polish HTML Browser Component
J2MEHTML
Fire
Unfortunatelly, neither of these seems to be agile enough so that I could implement it for my own puproses, which are:
render on any Graphics object
support for bitmap fonts
split content to pages
TeX hyphenation
be able to obtain the word (if any) at a given point on the image.
This all I've done, but the trouble is that it is not rendering html, but custom and limited styling.

I googled and found Cobra

Another option would be LWUIT
It has an HTML component in last version.(see http://www.nextgenmoco.com/2010/05/css-support-added-to-htmlcomponent.html)
LWUIT is a swing-insipered set of UI components for J2ME, it's open source and had some sort of SUN support, I don't know if oracle will still support it.

Related

What is the best way for a Java developer to generate Javascript without writing Javascript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am an experienced Java programmer, and Im trying to create a website with much of its content based on dynamic data from a database. The scope of the website is quite small with only about 5 webpage designs required ( although the user will see thousands of different pages generated from the data), but each page is quite complex.
I decided to go with plain old Java and Servlets as I understand this well, I also understand html and CSS so have no real difficultly generating the basic html pages from the data.
My problem lies with the addition of Javascript to improve the user interface. Ive tried using Javascript a few times over the years and always make very slow progress, if there is an off the shelf well documented solution such as a Jquery widget then I okay, but if I need to modify it or create custom Javascript I always get stuck.
Im looking for any alternative to writing pure Javascript. Im not looking at learning a new framewotk for the complete site, or for a way to abstract the html because I understand that and I don't really like deploying generated code that I didnt write.
But in the case of Javascript I would consider generated code, is there a tool that I could use to generate Javascript without writing Javascript that I could then reference from my webpages, or it impossible to consider Javascript and Html in isolation from each other.
Jeremy Ashkenas's public List of languages that compile to JS lists pretty many (~hundred) options.
The section for Java/JVM to JavaScript alone lists 15 choices.
Coffeescript is a language that generate Javascript. I haven`t used it, but friends that develop in Javascript have told me that Coffeescript is a nice tool.

Open Source HTML to PDF in Java (2014) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I've been searching high and low for an up to date solution to this age old problem.
Long story short I want to take css + html -> pdf and do it in java.
I don't want to use an API as the data is sensitive. Googling provides me with countless sites/services that offer to do this but I'm looking for a stand alone tool and looking for one that will work nicely from my java server. I've found this awesome looking command line tool but it's a command line tool and spawning processes off a web server starts to get sketchy IMO (but I'm always willing to hear otherwise). Additionally flying saucer seems to be a standard choice, but I've heard mixed reviews.
Here is a 5 year old question on the subject, but I figure things have changed! Especially with all the work being done in the area of front end unit testing with dom manipulation I figure there might be some less than conventional solutions and I'm willing to hear them all!
Any help would be greatly appreciated.
You might try a combination CSSBox that converts HTML+CSS to SVG and then use for example Batik for creating your PDF as proposed for example here. FlyingSaucer could also do the job.
The choice depends on your further requirements. E.g. are you processing "street HTML" or well-formed documents? What about the pages in the resulting PDF? What about interactive elements in the HTML pages?
I mean the only way is to try at least some options practically and then you may ask more specific questions about some particular problems.

Java User Interface Framework? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am about to build a UI in Java and I am trying to determine what I should use. I definitely don't want to use vanilla swing.
The one caveat is that it has to be added inside of an existing swing application. I am looking at JavaFX and Groovy Swing Builder. For the former it looks like there is fairly poor support for embedding into swing.
Anyone have another other suggestions?
The groovy guys are working on Griffon: http://groovy.codehaus.org/Griffon.
I believe it is supposed to model a console type GUI like a web UI.
Another possible answer is JavaFX. Here's a link to their hello world app:
http://javafx.com/docs/gettingstarted/javafx/create-first-javafx-app.jsp
Have you considered using NetBeans?
http://www.netbeans.org/features/java/swing.html
I'm not quite sure what you're looking for, but SwingX might fit the bill.
Contains extensions to the Swing GUI toolkit, including new and enhanced components that provide functionality commonly required by rich client applications. Highlights include:
Sorting, filtering, highlighting for tables, trees, and lists
Find/search
Auto-completion
Login/authentication framework
TreeTable component
Collapsible panel component
Date picker component
Tip-of-the-Day component
(SwingLabs seems to be down at the moment, though.)
Edit: On second reading, I guess you were actually talking about declarative UI builders? In that case, I'll refer you to another answer of mine in which I recommended javabuilders, a YAML-based Swing UI builder.
I've used JIDE in the past.
It's docking framework is pretty awesome.

Pure Java reimplementation of GraphViz? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Is there an Open Source java alternative to GraphViz? I'm aware of the existence of Grappa which basically wraps the Graph interface to GraphViz as an JavaAPI. However the layouting is still done by the GraphViz binaries.
I'm looking for a pure-java, open source library providing the same functions and layouting algorithms as GraphViz.
You can have a look at JUNG (Java Universal Network/Graph Framework) which has visualization and analytics functions. It's open source.
Interestingly, the Eclipse project has an SWT/JFace component/framework capable of displaying and generating (import/export) Graphviz's 'DOT' format, in pure Java:
ZEST (home page & download links)
See http://wiki.eclipse.org/Graphviz_DOT_as_a_DSL_for_Zest for usage examples.
Although ZEST is touted as an Eclipse plugin, it does seem that the DOT-manipulation API's can be used standalone and external to an Eclipse installation.
To clarify, the DOT functionality is a part of the ZEST 2 functionality, which itself is a sub-component of the GEF4 project.
Cheers
Rich
Update (May 2017) https://github.com/nidi3/graphviz-java
You could look at JGraph though I have never used it so cannot comment on now it compares to GraphViz.
yFiles seems to provide all this, but it's not free and not really cheap either. But then again it seems to be a very professional product (haven't used it, except in yEd, which can be used for free).
I guess ZGRViewer is what you want. I really like ZGRViewer and AJaPaD.
I worked with yFiles about four years ago, and it was excellent. It's costly (though less than JGraph, apparently) but I work in a CS research lab and had access to their generous academic pricing.

PDF Text Extraction Approach Using OCR [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Has anybody attempted to extract text from a PDF using an OCR library and Java? What did you find to be the most reliable library for text extraction. Most of the approaches I've seen (tesseract, GOCR) are C libraries that would require some JNI code to be written.
I'm familiar with pdfbox, which is now an Apache incubator project at version 0.8.x, but it's text extraction isn't always accurate. I'm looking for an alternative approach that is somewhat more reliable.
I've not tried Asprise JavaPDF yet, in the process of trying that, but wanted to know more about the OCR approach (if it's possible).
Any help would be appreciated.
If you have a text-based PDF, I'd strongly recommend PDFTextStream. It's not free, but licensing is reasonable, and it is much much better than PDFBox. PDFBox chokes on many PDF files which are generated by newer tools, and is not too consistent about PDFs it can handle. PDFTextStream handles any PDF I throw at it, including PDFs with embedded PNG images, which PDFBox can not do.
If you heckle the PDFTextStream folks to add OCR, they may listen up.
We use ABBYY FineReader Engine 11. They have java wrapper.
Pros:
It works great with all the languages (English, Russian, Uzbek etc) and doing real OCR (even if you have pdf without OCR they perform rendering at first and OCRing).
Cons:
It costs. You have to buy developer license and end-user license.
And it is EXTREMELY slow.
If you want to extract OCR from text based PDF you may have to convert it to an image first.
You can use Java wrappers of Tesseract - tesjeract or Tess4J - to perform OCR. However, for PDF, you'll need to convert to image (PNG or TIFF) first before feeding it to the OCR engine.
VietOCR calls Tesseract executable to perform the text extraction. It uses GhostScript to do PDF-to-image conversion.

Categories

Resources