In a work-related project, we want users to be able to write a document (in say Word) then upload this to our central web server. When they want to make changes, they visit the website and downloads the document. When changes are registered, the document is uploaded automatically.
I have written a few Java classes that does the work for me (FTP upload/download, File monitoring etc), but I'd like some input on how to solve the practical part of it.
Should the web page include a Java Applet that contains a Download button? When clicked, the document is downloaded and the associated editor is opened.
If so, how should I proceed? If the user closes his browser, wont be applet be terminated as well?
I have never worked on a such project before, and since Stackoverflow is filled with incredible smart people, maybe some of you could come up with some ideas?
PS: I'm new to posting on Stack, so please let me know if I should be more specific / add more information etc. :)
Best regards!
EDIT:
The application is only going to be used internally in our offices. Sorry if I caused confusion. :)
Related
To explain my situation, I currently have a large amount of PDFs (In the hundreds). Each PDF has a name associated with it and I need browse an external website my job uses to manage their files manually, clicking a button to "attach file" every time and manually selecting the file to upload to the site. If this sounds incredibly inefficient that's because it is, and doing this takes hours to finish while more of them pile up.
I already know how to deal with files, moving them around on a computer, and modifying them using JAVA, but I haven't done anything related to interacting with websites so I wouldn't know where to start.
I'll need to be able to perform the following actions or actions similar in order to complete what I have in mind.
General browsing of a website
Navigating through the website using
links provided by buttons on the page
Being able to click buttons.
Reading Strings present on the screen in order to compare names (Under a certain section there is a list of peoples names. If I detect that there are multiple people with the same name I want to skip the file and deal with it manually)
Clicking a button which brings up an upload menu and selecting a file to upload to it, or any other way of interacting with a feature such as this. (Like when you click Computer on IMGUR and it asks you to choose an image you would like to upload)
I'm not asking for anyone to straight up give me the answer I'm looking for (Though I'm not opposed if you are aware of how to do things such as these and would like to share.) but any guidance on where to find information on performing such actions would be helpful. I've already been searching and will be continuing to search for relevant information.
Thank you for any help you may be able to give.
It appears you want to automate some manual steps on a browser. You can take a look at Selenium WebDriver.
I have a application which is created on ZK Framework , i want to give user a functionality where user can open a saved file in edit mode and then again saved the changed in database can any one know which API can help me to do this?
You could use Google Apps to do so and set Google Docs to edit your DOC, PDF or even XLS extension files. For more help on setting it up, feel free to ask again. :)
The problem you're posing doesn't have a simple answer, unfortunately.
There are two general approaches you could take..
The low hanging fruit is to provide an interface for the user to download a file and upload it after they make edits using whichever editing software they choose / is appropriate.
The other approach would be to provide a GUI to edit files. Regardless of the web framework you are using, this is a daunting task to say the least. As #userRandom mentioned, this is a large part of what Google Drive (formerly Google Docs) is attempting to solve.. but even Google's solution is not perfect and very much a work in progress.
I would strongly suggest evaluating the scope of your project before proceeding.
If you choose to move forward, consider a simple solution that works for .txt files. Then, consider how you might handle .doc files. Then, PDF files, XLS files, etc.
Folks here will be able to answer specific questions.
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?
You may all have seen online content management systems or publishing platforms, where one can edit a page, but for convenience, the editing is not done in the browser, but instead in Microsoft Word. So whenever you open the page to edit it, the current page is send to MS Word and after completing the editing, Word sends back the page to the server.
A good example is Confluence. Instead of using the built-in WYSIWYG editor, you can also edit a page in MS Word.
How does this work technically? I want to program something similar on a Java servlet based web app. The first part is easy. I convert my page into the format of the external application and send it to the browser setting the correct mimetype. The external application will open the document. But I have no idea how the second part works. How does this application sends the file back?
Please send me any pointers you might have. My main problem is probably that I really don't know what I should search for. Also, if you know any opensource Java based projects doing something similar, I would like to study them to get started.
PS: Please feel free to change the title of this question!
One way this works is if you start Microsoft Word not wih a file as an argument, but witha n http/https URL that points to a WebDAV-supporting location. In this case Word will send the file bach witha PUT method when saving.
I am trying to link some user docs to my Java Swing application. The user docs are pdf and I would like to be able to click on a button in my application which opens up some sort of pdf renderer to display my userdoc.pdf.
I do not want to use the runtime exec command
I have tried the following with not much success --
pdfRenderer -- this seems to not work for the current version of pdfs (seems to want older pdfs)
acrobat viewer -- I keep getting font errors (the document is displayed but everytime I go to a new page, I get an error)
JPedal pdfHelp - This sounds cool and if it will work, it would be the best for me. But for some reason, I am unable to open any file here. No pdf file that I have loads in the window (The pdfHelp panel comes up with a list of pdfs as promised, but when I right click one of them and say "OpenPDF", I just get a progress bar and the file does not load, I have tried a few files on this and checked file permissions)
JPedal SimpleViewer -- So far this one seems to be the most promising. I would like to remove some of the functionality of this viewer though and am not able to edit the xml to do this. When I edit the xml, then I seem to get xml parsing errors.
Has anybody done anything similar that worked? Help please
PS. I need this to work on Linux machines (IcePDF seems to works only for Windows). I would very much prefer something that is free!
Would Java's Desktop API meet your requirements? It does launch another process, but it's not through you calling Runtime.exec().
The Desktop API uses your host operating system's file associations to launch applications associated with specific file types.
Update: pdfHelp from IDR solutions (creators of JPedal) works now. The latest version (4.0) has fixed the bug and it reads my pdf files (and I am sure more of the latest pdf files). Just playing around with the product today and it is great! There are few minor bugs but I really appreciate how quickly Mark Stephens(?) responded to the first bug. Good work guys!
I chose pdfbox for a similar use case - it's not perfect with every PDF, but works pretty well and is under active development. From the PDDocument you can get a list of PDPage objects, which have a convertToImage() method that gives you a BufferedImage you can draw on screen. I switched to this from pdf-renderer because I felt it gave better results in general.
PdfHelp has moved to its own domain at http://www.pdfhelp.org and have been updated to fix your issues and add some other improvements...