Freely View PDF File Online or via Java
Develop powerful Java based PDF document viewer utility application. Code listed to read PDF document through Java.
View PDF Document via Online App
- Import PDF file to view by uploading it.
- Do it by clicking inside the drop area via drag and drop of viewer app.
- Depending on the size of PDF file and internet speed, wait for few seconds.
- It will be automatically rendered and opened in the browser for view.
- Navigate between pages in case of multi pages PDF document.
- Set page view zoom-in or zoom-out.
View PDF File via Java
- Add Java library reference into project
- Load source PDF file using Document class object
- Save the document as HTML file
- Use ProcessBuilder for relevant paltform Windows, Linux or Mac
- Pass html file along with cmd.exe or xdg-open as parameters to view it
Java code to view PDF Files
try { | |
String htmlFilePath = "path/to/your/PDFFileToView.html"; | |
Document document = new Document("source-pdf-file.pdf"); | |
document.save(htmlFilePath, SaveFormat.Html); | |
String os = System.getProperty("os.name").toLowerCase(); | |
ProcessBuilder processBuilder; | |
if (os.contains("win")) { | |
// Windows | |
processBuilder = new ProcessBuilder("cmd.exe", "/c", "start", htmlFilePath); | |
} else if (os.contains("nix") || os.contains("nux") || os.contains("mac")) { | |
// Linux or MacOS | |
processBuilder = new ProcessBuilder("xdg-open", htmlFilePath); | |
} else { | |
System.out.println("Unsupported operating system"); | |
return; | |
} | |
// Start the process | |
processBuilder.start(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
Develop PDF File Viewer Application via Java
Need to develop a PDF viewer app or utility? With
Aspose.PDF for Java
a child API of
Aspose.Total for Java
, any Java developer can integrate the above API code within its document viewer application. Powerful Java library allows programming any document display solution that can support many popular formats including PDF format.
Java utility to process PDF file for display app
There are alternative options to install “
Aspose.PDF for Java
” or “
Aspose.Total for Java
” onto your system. Our Java package is designed to be cross-platform, compatible with JVM implementations on various operating systems such as Microsoft Windows, Linux, macOS, Android, and iOS. Please choose one that resembles your needs and follow the step-by-step instructions:
- Install Aspose.PDF for Java
- Or from Maven
- Step by Step Instructions
System Requirements
- J2SE 8.0 (1.8) or above
- Support of Aspose.PDF for Java on IBM i (Iseries or As/400)
For details please refer to [Product Documentation](https://docs.aspose.com/pdf/java/system-requirements/#optional-dependencies).
FAQs
- Can I use above Java code in my application?Yes, you are welcome to download this code and utilize it for the purpose of developing Java-based document viewer application. This code can serve as a valuable resource to enhance the functionality and capabilities of your projects in the domain of backend document processing such as reading content of the document for display app.
- Is this online document viewer App work only on Windows?You have the flexibility to initiate viewing documents at any device, irrespective of the operating system it runs on, whether it be Windows, Linux, Mac OS, or Android. All that's required is a contemporary web browser and an active internet connection.
- Is it safe to use the online app for viewing PDF document?Of course! The output files generated through our service will be securely and automatically removed from our servers within a 24-hour timeframe. As a result, the display links associated with these files will cease to be functional after this period.
- What browser should to use App?You can use any modern web browser like Google Chrome, Firefox, Opera, or Safari for online PDF document viewer. However, if you're developing a desktop application, we recommend using the Aspose.Total document processing API for efficient management.