Text to image on web server - java

I'm wondering if there is a way to create images out of text in a Java web app.
I'm using GWT to design a web app, and would like to allow some administration so that a small number of things could be edited by someone without a ton of savvy and not require a migration. This would be, say, menu headings, which I would otherwise create out of text in (e.g.) Photoshop, and include in my ear. Instead I want to allow an administrator to add some text, and I'd have some code to convert this to an image, using some specified formatting, for "nice" presentation.
As an example, the administrator might want to add a "news" page. So he will enter News and it will come out looking like:
Am I making sense? Is this something that is done? Are there libraries available for this?

This explains the concept pretty well.

Are you wanted to create Vector graphic then yes. You could also convert image into base64 string to store the image and reverse back loading at client.

Related

making a browser without using JTextPane or any other class that reads HTML

Good evening, I'm working on a project with a team, we have to make a browser without using JEditorPane or any other class that reads HTML.
How can we do that? Do we need to make a new class that does what JEditorPane does? Can I find somewhere JEditorPane's code? Thanks!
Well, this is an answer:
If you need to display web content without using any pre-existing engine (such JEditorPanel or a ChromeBind), you need to read the HTML as a XML file and construct your native View based on it (without CSS and JS this is a fairly easy task) by constructing the screen based on a one-to-one equivalent of a HTML tag to a Java JComponent.
Modern Web Browsers are pretty complicated, so there are a lot of different pieces that come together to display a web page. In order to build a browser, you need to first understand what a browser is. For that, I recommend reading this tutorial.
Once you have an understanding of how a browser actually works you need to determine which pieces you can reuse and which pieces you have to write from scratch. Do you have to write the entire rendering engine? Good luck! Can you use an existing engine like Gecko or Webkit? Or maybe you can get a little closer to done and use the java port of Webkit?
Once you have a better understanding of the question come back and ask more direct questions when you get stuck at a specific piece. As it is, your first step is to gain an understanding of the problem you are trying to solve.

Can one open another application within a javaFX frame?

I am currently working on a desktop application in which one can generate a responsive website for documentation (java-doc like) by providing nothing more than a simple word document.
I currently have a prototype working in which I select for styles on certain paragraphs to determine its function and how it should be transformed to a correct HTML representation. I also found a way to dynamically link to certain section of the document. Everything is working however I would really like to combine the list of documents to generate, a preview of the to-be generated website and a text editor program in 1.
since this will be relying on word heavily I was wondering if Java FX provides a means to display an application such as word or openoffice within an internal frame. Much like how Java Fx's webview displays websites.
In an ideal situation it would look something like this:
Any help would be greatly appreciated.
Alas, not possible in a plausible way.

How do can I share a PDF and interact with it remotely?

I want to make an functionality in which user can share the url of uploaded PDF. Now when the another user open the same pdf with given url, first person will scroll down and on another user can see the scrolled content directly or the pdf will be automatically scrolled.
Is it possible using Java, JavaScript or another technology?
Ex. Person 1 has shared exaple.pdf with person 2 by giving link of it.
Person 2 had clicked on link and the pdf is opened at his side.
Now person 1 is scrolling the pdf to page no. 3 and at the same time on the Person 2's screen the pdf will be auto scrolled to page no. 3.
Please let me know if my issue is still not clear.
If I were you I wouldn't definitely use PDF format because it's really hard to manipulate with. Instead of that, you could make your a document a HTML file and then listen to page events with JQuery (like scroll event). So far so good, this is the easy part.
Now you need to make clients communicate with each other so I think WebSocket is the best way for it. If you insist on Java, you can use brand new WebSocket API but it can be also implemented in pure JavaScript like Socket IO so you don't even have to use Java for it.
But if you have to work with PDFs, then good luck, it's going to be really tough task.
As Petr Mensik said it would be probably pretty hard to do it with PDF file with Java, JavaScript.
But if you really want I guess it would be appropriate to check some Adobe SDK. I'm not sure but maybe Adobe AIR or Flex or other Flash application.

Web application that deals with files -upload download

I have an existing swing desktop application that I wish to convert to a web application. The first thing that is stopping from doing so is that the desktop application deals with writing and reading from PDF files. Also the user fills up the PDF forms which needs to be read by the application.
Now a typical use case in the desktop application is like, the user logs in opens a PDF form and fills it up. The swing application manages where the file is stored so it goes to the file and reads the form, extracts the data and stores the data in the db. The user might not fill up the form all in one go. He might save it come back to it later and continue.
All of this needs to be done by the web app now. My problem is I don't want the user to download and upload the form multiple times to the server. That would eat the bandwidth and also asking the use to save the file locally and upload it back once he completes filling the form doesn't appeal to me since the desktop application nicely used to manage the location of these files as well.
Would I need to implement something like a dropbox kind of thing? A small deamon running continuously to check what file has been updated and upload it to the server? That would be difficult since at the server I wouldn't know if the file was latest or not. Is there anything like this that someone might have done before?
I have anther suggestion: why don't you show the user a form with the same fields and transfer them to the PDF after the user submits. This way the Pdf does not leave the server and you transmit just the minimal amount of data.
Switching to a web-version of the application may force you to re-think some of the way you are doing things. Certainly browsers are intentionally limited in their access to the local file system which introduces a major hurdle for your current mode of operation.
Even if you could display the PDF within a browser, detect the completion of edits and send this back to the server from within browser code (which is probably possible), you'll be subject to different browsers doing different (strange) things with whatever pdf plugin is installed.
As Vitaliy mentioned already, switching being able to populate a (web) form in the browser means that whole download upload problem goes away. But then you have to take what the user has done in a web page and pump that into a PDF somehow. If you don't HAVE to start with a PDF, but could collect the data and produce a PDF at the end then you might have more options. For example you could use iText to create a PDF directly if you don't have too many styles of document to work with. You could use something like Docmosis which you can give templates to and get it to populate and render PDFs later. With the Docmosis option you can also ask Docmosis for the list of fields in the template so could build a web form based on the selected template, let the user fill it in, then push that data to Docmosis to produce the file.
Hopefully there's some options there that are useful to you.
Adobe documents how to do this here. Never underestimate the power of design-by-google. I know this can be made to work because I've used PDF forms on line.
I worked on a similar issue a few years ago, although I wasn't dealing with signed forms. The signature definitely makes it a little more difficult. However, I was able to use iText to create a PDF form with fields, and only submit the field data back to the server. Offhand, I unfortunately do not remember exactly what/how we did it, but can confirm it is doable (with limitations/caveats). Ex: User had to have PDF reader plugin installed & User was forced to d/l the pdf every time.
Basically what I did was use iText to create an FDF from a PDF (with form existing form fields). The submit button in the FDF actually submits the form data to a URL of your choosing (not unlike an HTML form). Once you have that data, I believe I merged the form fields (from the FDF) with the PDF on the server side using iText.
Once you use the server to maintain all the form data, the synchronization/locking process you use to ensure that a single user is updating the latest and greatest form data is up to you.
Your comment under jowierun indicates that you want to deal with word/excel/etc docs as well, so I am not entirely sure I am understanding your needs. Your initial post discussed the needs to fill out PDF forms locally, but afterwards it sounds like you are looking for a file-sharing system instead.
Can you please clarify exactly what you are trying to accomplish?

Drag and Drop an Email from MS Outlook to Eclipse RCP

Has anyone got a working solution without some Java/COM-bridge? E.g. process the Email as a file (.msg) rather than locating the data that is referenced in the Clipboard?
Maybe this is a solution for your problem:
http://sourceforge.net/projects/javaoutlookdd/
It allows to handle outlook items like File objects during drag&drop.
I did make some headway on this sort of thing a few years back using Apache POI to extract the contents of an email from .msg files. I'm pretty sure they have a simple swing explorer / viewer that you can use to examine the structure within the compound document format, but I can't find it right now.
I was able to extract most information that I was interested in but was ultimately wanting to create a mime format version of the message and couldn't extract all the information I needed in a format I could use.
I assume that you've already ruled out the tools in "org.eclipse.swt.dnd" for some reason? There are some examples here on how to go about using them, in case you haven't. If what you really want to do is drag&drop, you're going to have to do some work with those tools. At that point, really the question becomes, what format is it in on the clipboard, vs in a file, and which is easier to integrate into your app.

Categories

Resources