How to launch a PDF File using PDFBox -


I want to spend time while opening a PDF file. I can not find a way to use this PDFBox. I have created a PDD document in my Java program and want to use some APIs to launch a PDF file through my code. I'm unable to figure out which PDFBox API objective. So it would be useful if I could get some information on it.

Thank you. Swati

File C in the document Drive.

If you execute the Java code below, then it will open Adobe Acrobat in the 04-Request-Headers.pdf file. The total time to open the PDF file is displayed in the console.

Below is an example of how to open a PDF file using Java.

Code:

  package com.pdf.pdfbox.test; Import java.awt.Desktop; Import java.io.file; Public class OpenPDF file using Java {public static zero main (string [] ARGs) {file file = new file ("C: / document / 4-request-header PDF"); If (file.exists ()) {long startTime = System.currentTimeMillis (); Desktop.getDesktop () open (file). Long end time = system Time Received (); System.out.println ("Total Time to Open File ->" + file.getName () + "in" + (End Time - Start Time) + "MS"); } Else {System.out.println ("File does not come out ->" + file.getAbsolutePath ()); }} Hold (exception e) {e.printStackTrace (); }}}  

Output: took the total time to open the file - & gt; 04-Request-Headers PDF in 94 ms


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -