Board index » jbuilder » Opening a PDF File
|
Matt
JBuilder Developer |
|
Matt
JBuilder Developer |
Opening a PDF File2004-10-28 05:20:14 AM jbuilder4 I am a former FoxPro developer migrating to Java. How would I open a PDF file for viewing in Java? |
| Paul Furbacher [TeamB]
Java Developer |
2004-10-28 11:27:23 AM
Re:Opening a PDF File
Matt wrote:
QuoteI am a former FoxPro developer a native viewer like Acrobat, you could try something like Runtime.exec("Acrobat", filename); (That's just off the top of my head; you'll have to do some research on the exec() method. Google is your friend; use it to search the archives of these newsgroups and other resources on the keyword of "runtime.exec" -- use double-quotes to indicate an exact phrase search requirement.) If what you want to do is read and write PDF source, you might want to check one of several PDF/Java libraries. One is www.lowagie.com/iText/ Another is PJ www.etymon.com/epub.html Again, Google is your friend: think, enter search pattern, press return. -- Paul Furbacher (TeamB) Save time, search the archives: www.borland.com/newsgroups/ngsearch.html Is it in Joi Ellis's Faq-O-Matic? www.visi.com/~gyles19/fom-serve/cache/1.html Finally, please send responses to the newsgroup only. That means, do not send email directly to me. Thank you. |
| John McGrath [TeamB]
Java Developer |
2004-10-29 07:07:42 AM
Re:Opening a PDF File
On 10/27/2004 at 11:27:23 PM, Paul Furbacher [TeamB] wrote:
Quote>I am a former FoxPro developer looks like it is still available, but I am not sure if it is viable with current JDKs. It is available here: www.pacific.adobe.com/products/acrviewer/main.html There are other all-Java PDF viewers available. I know that IceSoft has one. FYI, these are the guys who produce the HTML viewer used in JBuilder. www.icesoft.com/ QuoteAgain, Google is your friend: think, enter search pattern, press return. Regards, John McGrath [TeamB] --------------------------------------------------- Before sending me e-mail, please read: www.JPMcGrath.net/newsgroups/e-mail.html {smallsort} |
| Matt
Java Developer |
2004-10-30 05:15:50 AM
Re:Opening a PDF File
"John McGrath [TeamB]" < XXXX@XXXXX.COM >wrote:
QuoteOn 10/27/2004 at 11:27:23 PM, Paul Furbacher [TeamB] wrote: Process rt = Runtime.getRuntime().exec(cmd); DataInputStream showIt = new DataInputStream(rt.getInputStream()); I substituted various commands for cmd. I received an IO error for EVERY command that I entered. Is there a piece to the puzzle that I missed? Thank you very much for your time and patience. Respectfully, Matt Quote
|
| tor.iver.wilhelmsen
Java Developer |
2004-10-30 05:00:02 PM
Re:Opening a PDF File
"Matt" < XXXX@XXXXX.COM >writes:
QuoteI substituted various commands for cmd. I received an IO error for located. For Windows it's somewhat easier in that you can use "start" to invoke any file's default viewer. Also, using the single-String method has risks related to escaping spaces in filenames etc. You should ALWAYS use the String[] method for this reason, where you split the commandline before the shell gets at it. |
| Paul Furbacher [TeamB]
Java Developer |
2004-10-30 11:50:28 PM
Re:Opening a PDF File
Tor Iver Wilhelmsen [TeamB] wrote:
QuoteFor Windows it's somewhat easier in that new String[] { "open", "pdfFilename" }); where variable pdfFilename is the /path/to/file/filename.pdf From an OS X Terminal session, do a man open to read the details. I'd advise doing a quick test from the command-line in the Terminal to see that the command is correct before putting it into code. For instance, I just did % open /Users/pf/Desktop/*.pdf It worked, maybe too well, because I didn't realize that I had some rather large PDFs sitting on my Desktop. The hard disk cranked for a while, apparently while it opened the "Subversion" book. If the PDFs are in sub-directories of the user.dir, you probably can use relative paths, as you could from the command-line: [PFs-Computer:~/Desktop] pf% open ./Subversion.pdf (Incidentally, this same kind of question came up in the macintosh newsgroup the other day. I'm just expanding on the solution arrived at there.) -- Paul Furbacher (TeamB) Save time, search the archives: www.borland.com/newsgroups/ngsearch.html Is it in Joi Ellis's Faq-O-Matic? www.visi.com/~gyles19/fom-serve/cache/1.html Finally, please send responses to the newsgroup only. That means, do not send email directly to me. Thank you. |
| adam brett
Java Developer |
2007-08-31 03:48:22 AM
Re:Opening a PDF File
Dear All,
I have a database containing HTML. I have written an IW app which does a good job of displaying it, including the embedded image tags which are in the form <src="/Files/Images/FileName.jpg">. I pass the content into a TIWText object with RawText := true; and it shows in the browser very nicely. The same content contains links to pdf files in the form: <a HREF = "/Files/ProjectTechnicalReports/R5732_2PS.pdf">Leaflet: Tree fodders for livestock on smallholder farms</a> ... These segments show as HTML links & I had hoped that clicking them would open the PDF ... but it does not. Is there a work-around for this, or how do I achieve this functionality? Adam |
| Farshad
Java Developer |
2007-08-31 04:07:07 AM
Re:Opening a PDF File
As far as I remember IW doesn't allow access to Subdirs by default. You are
putting your PDF file inside a Subdirectory. There was an option to overcome this. Something like AllowSubDirs in the SessionManger. "adam brett" < XXXX@XXXXX.COM >wrote in message QuoteDear All, |
| adam brett
Java Developer |
2007-08-31 08:52:28 PM
Re:Opening a PDF File
Thanks for this, but I already have ServerController.AllowSubFolders :=
true; The key issue is that all my images are loading fine, whether the path contains sub-folders or not. However the links embedded in the HTML don't run. A decent clue (though I haven't figured out a solution) is that when I hover the mouse over the link I can see the following in the browsers status-bar (at the bottom of the page) www.mydomain.co.uk/myissapiappname.isa/EXEC/40/\files\library\RNRSSOutputs\Filename.pdf ... note that this is not a valid URL. The first part is the URL for the page (up to the "40") the section after that is the part for the file-link. 1. Can I put a Java script on the page that would respond to the above URL correctly opening the pdf file? 2. Can I re-write the link (the "\files\library\RNRSSOutputs\Filename.pdf" part) so that it would work? 3. ... or is there another way! Adam "Farshad" < XXXX@XXXXX.COM >wrote in message QuoteAs far as I remember IW doesn't allow access to Subdirs by default. You |
| Farshad
Java Developer |
2007-08-31 09:16:25 PM
Re:Opening a PDF File
Interesting!
I wrote a small program and assigned below code to IWText1 and it works fine. IWText1.Lines.Add('<a href="/Files/ProjectTechnicalReports/R5732_2PS.pdf">Link</a>'); When I hover over the Link it correctly displays the desired path: 127.0.0.1/Files/ProjectTechnicalReports/R5732_2PS.pdf |
| Bob Swart
Java Developer |
2007-08-31 09:32:41 PM
Re:Opening a PDF File
Hi Adam,
QuoteA decent clue (though I haven't figured out a solution) is that when I hover QuoteAdam -- Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux) Blog: www.drbob42.com/blog - RSS: eBob42.com/weblog.xml |
| adam brett
Java Developer |
2007-09-01 07:58:30 PM
Re:Opening a PDF File
Thanks for both of these responses. It actually seems like I may have a more
deep-seated problem. In order to get around my first problem with the TIWText component, I have created a URL component & tried several methods to navigate to a URL from it. In every case my IWApp just gives a "Timeout" error when I click on the item ... whether it is an IWText, an IWURL or even a button with the code WebApplication.NewWindow('www.stepsystemsdata.co.uk/html/cgi-bin/Files/Help/index.htm'); in it. ... is there something I have to set in my IWApplication to allow it to navigate "out" to other pages?? Adam "Farshad" < XXXX@XXXXX.COM >wrote in message QuoteInteresting! |
| Jason Southwell
Java Developer |
2007-09-05 03:29:57 AM
Re:Opening a PDF FileQuoteWebApplication.NewWindow('www.stepsystemsdata.co.uk/html/cgi-bin/Files You probably just need to include the http:// to the beginning of the URL line. |
| Peter Tickler
Java Developer |
2007-10-16 07:00:31 PM
Re:Opening a PDF File
"adam brett" < XXXX@XXXXX.COM >wrote:
QuoteThanks for both of these responses. It actually seems like I may have a more |
