Extracting text from a PDF using JBoss Richfaces - java

I am trying to write a web-app to manage references for my PhD thesis.
I used to manage this information inside a personal Confluence (fantastic tool! - http://www.atlassian.com/software/confluence/) instance however I'm fed-up with the opening of PDF's and cutting and pasting values into fields that I wish to record.
I have exposed a webservice that will return me images based on a PDF filename and a page number. The same webservice also exposes a method that will return the text inside of a provided rectangle (top left x-y coord, bottom right x-y coord).
I would like to be able to drag a rectangle over part of the PDF image and then call the webservice to give me the text (which I will then store on a EntityBean). I am looking at using the JBoss application stack (Application Server, Hibernate, Seam and Richfaces). Does anybody know how I could go about achieving this? I have seen the ability to draw custom images in other RIA toolkits (e.g. dojo), but I can't see a way of doing this inside of Richfaces.
Hopefully somebody out there could prove me wrong, or provide some idea about what I can do (as I am not a web developer - I'm mainly building this tool because the RIA frameworks available now have got me interested!)
I already have the code to extract the text, my problem is purely how can I get the user to draw a "selection rectangle" inside the web browser over the top of the image?
Many Thanks,
Aidos

Try using the RichFaces Paint 2D tag
It exposes the Graphics2D package to the user interface.
Track user drag events on the image using javascript, then post the co-ordrdinates to the backing bean to re-render the image with a drawn on selection box.

Have you considered Mendeley ? It will try to parse and extract bibliographic information from your pdfs.

you can do it with itext (http://www.lowagie.com/iText/)

Related

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.

Check printing with Java/JSP

I'm working on an existing Java web application (HTML/CSS/JS/JSP/Servlets and Java classes in this particular app) that currently uses an applet to print checks.
My boss recently came to me and informed me that there are errors coming back on user's machines when testing the check printing against the latest versions of Java.
He is wondering how we could set up the application to print checks off without using an applet.
In the past, I've used Crystal Reports to lay out forms and print them but that was in asp.net.
I know there are Java PDF libraries available but I'm not at all familiar with any of them and not sure that they could be used to format and print checks in a Java web application.
So, I'm ultimately wanting to know about what has worked for those who have implemented check or form printing using Java/JSP/Servlets.
2012-02-24 # 13:15EST edit
I mentioned "Java PDF libraries" above but have since found out that PDF cannot be used as end-users should not be able to save the check documents (unless PDF's can be made to not be saveable and just printable). All of the data is managed right on the database (Oracle in our case).
I've used iText to create PDF files before for things like this. PDF is your answer, since the whole point of the format is that it never really changes. Much better than an Applet.
http://itextpdf.com/
I ended up digging deeper into using iText and came across flying-saucer which makes it super-easy to render a PDF from XML or XHTML.
Check it out at http://code.google.com/p/flying-saucer/
I also found out how to partially hide the save functionality by rendering the PDF inside a hidden iframe: Create a "print-only" PDF with itext

Can I draw State-Transition diagrams in JSF2 Web App?

I'm looking for a way to draw state-transition diagrams in my JSF2 project.
I would like to be able to load state and transition data and transform them in a graph that can be displayed on my web page.
I haven't found a way to do that yet. Charts available with Primefaces or MyFaces projects (I'm using the 1st one) are dedicated to statistics. In addition, it's probably possible to do that in javascript but I didn't found any example of that in the Google's API's for example.
Any suggestion or help would be appreciated.
Thanks a lot.
Clément
I doubt there are components that display graphs using plain html, but you might look for a library that generates an image which you can display in your page. That library wouldn't necessarily be JSF specific though.
Edit: maybe JUNG might be of interest for you.
In addition PrimeFaces' dynaImage might help you with displaying the generated graph image.

Text to image on web server

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.

Categories

Resources