Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suggestion needed for designing application in JAVA

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
0
0
US
I'd like to have a webpage that lets a user click on a link (associated with a text doc) and open a text doc in an app like Acrobat Reader. Is it a wise step to design it with Java? I realize I may need an OCR, but is this achievable? Can Java open other applications? Do I need JavaBeans, Swing? What else would I need to do (besides design the Java program) to accomplish my goal? I'm really new to Java (I'm up to encapsulation).

Many thanks for your help.
Change Your Thinking, Change Your Life.
 
What you are asking is a vague question. Opening a document in a browser is a client side function--java, at least server side java, is of no use here. You mention a text document but you want it viewed as PDF. Why? A browser can open a text document just as easily as an HTML page. You could have your server convert the text document to PDF and send the PDF doc back in the request but why would you do this. Why not preconvert all of your text documents to PDF beforehand.

It sounds like either you aren't sure what you are really trying to do or you may be a little confused about HTTP and web programming. Maybe if you clarify the GOAL and REQUIREMENTS of what you are trying to do it will make helping you easier.

Cheers
 
I think what he is getting at is he wants the text doc to open in a frame based app LIKE when you open a PDF. I agree with meadandale though. This seems irrelevant since browsers can already open text docs.
 
Guys,

I didn't want to get to wordy, but here's exactly what I'm looking to do:

Description:

1. A web user accesses a URL page that has a "View Document" link. When the link is clicked, there is a list of image system documents (links) returned to the screen. The docs are contained on an image server.

2. The user clicks one of the links and the document (image) loads into Acrobat Reader as a PDF.


I understand you can open the text documents using HTML, but I have to go out and grab document images from a file server, and return those to a web page as links, and have the web server open them up as PDFs in Acrobat.

Thanks for your help.

Change Your Thinking, Change Your Life.
 
It's clearer now, a little bit.

If you store the PDF files on the server in your web context, all you need to do is put a link on the page to the files and the browser will automatically display them if the user has acrobat installed, just like it does all the other web pages. The server doesn't open up anything in acrobat, this is all on the client. The server just sends you the bits.

If, however, the files are stored on another machine and you want the web app to use the link to load the PDF from another server, that is easy to. You just have the servlet open the file and write it out to the servletresponse. The one change you will have to make is you will have to be sure to set the header in the response to the correct MIME type for PDF files (do a search on mime types and you'll find it).
 
Hi meadandale,

I still don't think I'm being clear. The files are not already in .PDF format. These are document images that have been put on the server via a scanner or fax. The types of images will be .tif or .txt. My client wants the ability to view all of these documents as .PDFs, which means I'll have to utilize some type of image editor.

To clarify, I believe my main steps are as follows:
1) Obtain the list of documents(.tif, .bmp, .txt types) from the file server
2) Deploy some type of Image Editor to get my images "web viewable"
3) Deploy Acrobat REader to open these images into as PDF.

I just wasn't sure which pieces could be written in Java, and if so, what approach to take.

I hope this is more clear.

Thanks for any assistance you can provide.

scripter73
Change Your Thinking, Change Your Life.
 
Ahh, ok. So, it is possible to pre-convert these image files to PDF's? That would be the preferred method. If you can't do that, you will have to do on the fly conversion to PDF and send that data back to the client. The only difference between this and what I mentioned earlier is the file conversion.

If you can do the file conversion beforehand, the links should just be images to the documents. If you can't, then the link will be to the servlet with a fileid and the servlet will do the conversion on the fly and return the PDF document. We do this to generate insurance forms but we go from data->html->pdf. If you do a google search, you will probably find a converter that does what you are looking for.
 
Cool, thanks. I'm glad I could clear it up. Sorry the confusion. Let me go do a little research, and I'll probably post back to this thread soon.

Thanks again for your help!

Change Your Thinking, Change Your Life.
 
I've done this in ASP using VB dll's so not sure about Java specifics but i used a program called tiff2pdf to convert documents on the fly, my DLL (replace with servlet / EJB i guess) just called the external program to do a conversion then passed the resultant filename to a HTML page using

<embed ALT=&quot;Large Document&quot; width=100% height=100% src=&quot;<%Response.Write(myfile)%>&quot;>

The file was held temporarily in a session file area but i would imagine java would let you do it inline.
 
Hi AlistairMonkeyFinger,

Is tiff2pdf an Image Editor? I keep wondering if I'll need one. I figure most likely I will. So all I have to do is obtain the documents, store them in a list, and as the user chooses them, deploy this Image Editor (like tiff2pdf), and display the document? Is it really that easy? Also, not all of the documents will be tif, some may be text, etc.

Please confirm.

Thanks.
Change Your Thinking, Change Your Life.
 
Hi,

tiff2pdf is more a command line image convertor so i guess you would use runtime.exec() with something like
Code:
Runtime.getRuntime().exec(&quot;cmd tiff2pdf source.tiff myfile.pdf&quot;)
(don't quote me on that![upsidedown]) but it depends wether you decide to do all the converting up front or on the fly.

We got tiff2pdf from FastIO systems:


It doesn't cost that much though the (free) demo version allows you to convert documents up to 150pages. You'll still need to find a convertor for your .txt files though.

Once you've got the document as a pdf on the server you're there, just launch a html page with

<embed ALT=&quot;Large Document&quot; width=100% height=100% src=&quot;myfile.pdf&quot;>

good luck

Alistair
 
Hi AlistairMonkeyFinger,

Thanks for your great advice. So I will have to purchase a piece of 3rd party software to complete my goal.

Your advice is greatly appreciated. With the help of you, and people like you, I gradually can put together my jigsaw puzzle of a project. I hope I can help you out someday.

scripter73
Change Your Thinking, Change Your Life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top