Article View: borland.public.jbuilder.java.language
Article #7975Re: Calling Acrobat Reader from Java
From: Erwin Olaerts
Date: Fri, 04 May 2001 12:18
Date: Fri, 04 May 2001 12:18
57 lines
2664 bytes
2664 bytes
Thank you for your help !!! That's more or less the way I do it too !!! Only
I don't use a string with the path to acrobat reader.
I let the os decide wich program to be used. You can do this by writing the
exec command like this:
Runtime.getRuntime().exec("cmd /c Start filename.pdf");
"Robert" <robert.spilleboudt@securex.be> schreef in bericht
news:3AF174AA.BB59E0C5@securex.be...
> Hi ,
> I use the runtime.
> In this program:
> o.printFilePdf(os) creates a file, intended to be sent by email
> Then I prepare a command . auteur.acrobat is a string with the path to
acrobat
> reader and fileIdPdf is the file name
> You get a new window with acrobat reader and your file.
>
> I assume this is a answer to your problem
>
> Robert
>
>
> void jButtonPrintFile_actionPerformed(ActionEvent e)
> {
> file://crοΏ½er un fichier pour envoi par email
> try{
> messages.setText ("printing....");
> calculValid();
> file://o.printFileTxt();
>
> String fileIdPdf = auteur.chemin+"Reports\\"+o.fileId+".pdf";
> FileOutputStream os = new FileOutputStream(fileIdPdf);
> o.printFilePdf(os);
> // impression pdf:appel de acrobat reader
> Runtime r = Runtime.getRuntime();
> Process process = null;
> String[] command = {auteur.acrobat,fileIdPdf };
> process = r.exec(command);
>
> messages.setText ("");
> }
> catch (Exception errPrintFile)
>
> Erwin Olaerts wrote:
>
> > Hi,
> >
> > Can I call Acrobat Reader from my Java-application to view a PDF ???
> >
> > In the print-tool I use, I can save my report as a PDF-file, but I want
to
> > view it with a call from my application. How can I do this ?
> >
> > Hope someone can help. Many thanks in advance,
> > Erwin
>
Technical Details
Message-ID:
<3af29e0e$1_2@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3aeffbf9_1@dnews> <3AF174AA.BB59E0C5@securex.be>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,8a1ca0fc2d792ffd X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-04 05:40:05 PST From: "Erwin Olaerts" <erwin.olaerts@idp.be> Newsgroups: borland.public.jbuilder.java.language References: <3aeffbf9_1@dnews> <3AF174AA.BB59E0C5@securex.be> Subject: Re: Calling Acrobat Reader from Java Date: Fri, 4 May 2001 14:18:06 +0200 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 212.123.9.31 Message-ID: <3af29e0e$1_2@dnews> X-Trace: dnews 988978702 212.123.9.31 (4 May 2001 05:18:22 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews