Web application that processes files -upload download

I have an existing swing desktop application that I want to convert to a web application. The first thing that dwells on this is that the desktop application deals with writing and reading from PDF files. The user also fills out PDF forms that must be read by the application.

Now a typical use case in a desktop application is similar, the user registers in PDF form and fills it out. The swing application controls where the file is stored, so it goes to the file and reads the form, retrieves the data and saves the data in db. The user may not fill out the form at a time. He can save him, return to him later and continue.

All this needs to be done using a web application. My problem is that I do not want the user to upload and download the form several times on the server. This will use bandwidth and also ask to use a local file and upload it after it fills out the form, and I do not like it, since the desktop application is perfectly used to control the location of these files.

Do I need to implement something like Dropbox type? Does the little deamon constantly work to check which file is updated and upload it to the server? This would be difficult, since on the server I would not know if the file was the last or not. Is there something similar that someone could have done before?

+6
source share
4 answers

I have a suggestion from the player: why don't you show the user a form with the same fields and transfer them to PDF after the user submits. Thus, Pdf does not leave the server, and you transfer only the minimum amount of data.

+5
source

Switching to the web version of the application may make you think about how you are doing something. Of course, browsers are intentionally limited in access to the local file system, which creates a serious obstacle to your current mode of operation.

Even if you can display the PDF file in a browser, detect the completion of editing and send it back to the server from the browser code (which is probably possible), you will be exposed to different browsers that perform different (strange) things with any PDF plugin.

As Vitaly already mentioned, switching to the filling method (web form) in the browser means that the problem of downloading the entire downloaded file disappears. But then you have to take what the user has done on the web page and somehow transfer it to a PDF file. If you do not need to start working with a PDF file, but you can collect data and create PDF files at the end, you can have more options. For example, you can use iText to create a PDF file directly if you do not have too many document styles to work with. You can use something like Docmosis, which you can give templates, and make it fill and render PDF files later. Using the Docmosis option, you can also request Docmosis for the list of fields in the template so that you can create a web form based on the selected template, allow the user to fill it out, and then pull this data into Docmosis to create the file.

I hope there are some options that are useful to you.

+3
source

Adobe documents how to do it here . Never underestimate the power of design for google. I know this can be made to work because I used PDF forms online.

0
source

I worked on a similar problem a few years ago, although I did not deal with signed forms. The signature definitely makes it a little more complicated. However, I was able to use iText to create a PDF form with fields and send the field data only to the server. Offline, unfortunately, I do not remember exactly what / how we did it, but we can confirm that it is doable (with limitations / reservations). Example: a user had to have a plugin installed to read PDF files, and the user was forced to d / l pdf every time.

I mainly used iText to create FDF from PDF (with forms of existing form fields). The submit button in FDF actually transfers the form data to the URL of your choice (as opposed to the HTML form). When you have this data, I find that I combined the form fields (from FDF) with the server-side PDF using iText.

Once you use the server to store all the form data, the synchronization / blocking process that you use to ensure that one user updates the latest and largest form data is up to you.

Your comment in the jowierun section indicates that you want to deal with word / excel / etc docs, so I'm not quite sure I understand your needs. Your initial post discussed how to fill out PDF forms locally, but later it sounds like you're looking for a file sharing system.

Can you clarify what exactly you are trying to accomplish?

0
source

Source: https://habr.com/ru/post/922127/


All Articles