Java PDF Viewer for your Java Applications
Providing everything needed to embed customizable PDF Reader in a Java client API
Display PDF files in your Java Applications
JPedal is supplied as a jar or via Gradle or Maven.
Add these lines of code into your Java code:
Viewer viewer = new Viewer();
viewer.setupViewer();
viewer.executeCommand(ViewerCommands.OPENFILE, "pdfFile.pdf");
ConvertPagesToImages.writeAllPagesAsImagesToDir("inputFileOrDir", "outputDir", "bmp", 1.33f);
ExtractTextAsWordList.writeAllWordlistsToDir("inputFileOrDirectory", "outputDir", -1);
ArrayList<Float[]> resultsForPages = FindTextInRectangle.findTextOnAllPages("/path/to/file.pdf", "textToFind");
PrintPdfPages print = new PrintPdfPages("C:/pdfs/mypdf.pdf");
if (print.openPDFFile()) {
print.printAllPages("Printer Name");
}
final PdfUtilities utilities = new PdfUtilities("path/to/exampleFile.pdf");
try {
if (utilities.openPDFFile()) {
// Returns a String containing all metadata fields for the document
final String documentPropertiesAsXML = utilities.getDocumentPropertyFieldsInXML();
// Returns the total page count as an int
final int totalPageCount = utilities.getPageCount();
for (int i = 1; i != totalPageCount; i++) {
// Get the page dimensions for the specified page in the given units and type
final float[] pageDimensions = utilities.getPageDimensions(i, PdfUtilities.PageUnits.Pixels, PdfUtilities.PageSizeType.CropBox);
// Returns the image data as a String for the specified page
final String xImageDataForPage = utilities.getXImageDataForPage(i);
}
}
}
catch (final PdfException e) {
e.printStackTrace();
}
utilities.closePDFfile();
WritableAnnotation[] annotations = new WritableAnnotation[2];
annotations[0] = new SquareAnnotation(1, 10, 10, 100, 100);
annotations[1] = new CircleAnnotation(2, 10, 10, 100, 100);
AnnotationWriter.writeAnnotations(inputFile, outputFile, annotation);
ExtractClippedImages.writeAllClippedImagesToDir("inputFileOrDirectory", "outputDir", "outputImageFormat", new String[] {"imageHeightAsFloat", "subDirectoryForHeight"});
What do other developers think?
JPedal PDF Viewer Key Features
JPedal provides a complete Java PDF Viewer which is easy to integrate and customise into your Java applications as a Swing Component. Features include:
![Complete PDF Viewer](/assets/bookmarks-1881a7e30de1f92e18a07da3c728ec18bded7e15d77e1f6c005a485602046c14a0e8c7a7bc14cbff68da7eb998257aff6cd85ec07c6c71832720186d96579880.png)
Complete PDF Viewer
View pages in Multiple Modes
JPedal provides all the display modes present in Adobe Acrobat along with Page turning and its own unique Page Flow mode.
![Viewing PDF file in Single Page Mode](/assets/single-page-mode-1ecfaa0b3f25484fd460c34d9a4f317bb4e92380a14a492991146bcb9c1d3a665f2f24fe17600ccdb78322fda35342cddeb5e9f66465203d320f7d2ff6fee23d.png)
Single Page Mode
![Viewing PDF file in Continuous Mode](/assets/continuous-mode-5327558d116873afdb05edc18699da28adf60d2ae29330f739bdbd11495356f271696fccde152c4cb3873cee5a626c1d9018a9517a7b6fe971de25bd28005804.png)
Continuous Mode
![Viewing PDF file in Continuous Facing Mode](/assets/continuous-facing-mode-57ae860c4dad33068a74e1c210f6a4884d6d7188af7c1721645c80bfb19ceb50a7a959144538a6d12d0c322d3f3299767f8e0c19d1654071bfae70e0840b2afc.png)
Continuous Facing Mode
![Viewing PDF file in JPedal Facing Mode](/assets/facing-mode-7f850709ba804c8a7bf118bc31048b837f25fd566a22771a9ca01adb0da2d1e3c42d7e0bc1cd0e46ea7cf1e3d88ccef7f781bd1394a09ef1ffa71e31fa24afbe.png)
Facing Mode
![Viewing PDF file in Page Flow Mode](/assets/pageflow-mode-24567b41d1004866a213a9a8a15e3d130b40f5e74a35593eecc7b77b17cb62305f52d0cadf893ef47ed97754ccc1bb61a44a59eb2a5a377ccb6cda959d9345ad.png)
Page Flow Mode
Print PDF Files
JPedal can print PDF files directly from the PDF Viewer.
- Select any available printer
- Preview output in GUI window
- Specify the scaling, page margins and resolution
- Choose any page range including odd or even pages or any sequence.
- Print in grayscale
- Print in fast draft mode
- Choose paper source by PDF page size
![JPedal Viewer Example](/assets/printing-46f310fd9c9a73a49b3ea88c81f20dfed891f55cee9d3b5df6d483420f8d70c394c23b95a0a1465ae7cc74095d577e7e19d071cd963e02e4c62f044dec84b645.png)
Display/Edit PDF Forms
JPedal includes full support for PDF forms.
- Display original AcroForms
- Support for pure/mixed/legacy XFA PDF forms
- Convert Forms into editable Swing widgets
- Resave Form data back to PDF file
- AP streams used if available
- Display of form signatures supported
![JPedal Viewer Example](/assets/costena-613a321df78b64370550a1169524a55e47e89f547550be43db6aad981fe34e2b3fcc6b271e03b131a57f3608d8071c1d3984ba080815c94c93433316ff9f78b1.png)
Find / Search Text
JPedal can search for text directly from the PDF Viewer.
- Search one page or the whole document
- Use Regular Expressions
- Restrict search results to whole words
- Search with case sensitivity
- Allow search results across multiple lines
- Ignore space characters when searching
![JPedal Viewer Example](/assets/text-search-03ba5f24559c9ee44653a0d4014cffe774d782ea6ef6bda572e5e2276d240fde1985e0dc20d5a1670919df796653e56e7dbf6123da929c5a687e8d62966107e5.png)
Add / Edit PDF Annotations
JPedal can only view but also edit and add annotations to PDF files.
- Edit existing Annotations
- Add new Annotations
- Resave edited file
- GUI Drag and Drop editor
![JPedal Annotations Example](/assets/annot_properties_panel_zoom-5c5157a4fc42da777f7dad8f90c4279182ab3dadcddab2994fe6f5949ed79ab7061e9f2f482b8f6492576906661fce5c70fc71a13bd9675b12a1118de7a5ba5a.png)
Zoom, Scale, Rotate PDF Pages
JPedal can dynamically change the view with scaling and rotation options.
- Clockwise and anti-clockwise rotation
- Scale in or out by any percentage
- Fit to Page, Width, Height
- Pages are dynamically resampled to optimise image shown at given scaling.
![JPedal Scaling and Rotation Example](/assets/scale-5376a9e67abf703d56639531cba1216d0dcb814af5e89ed25b89ab7049d98a18e44e03335fae34734d29bd036f296afb4230c3229c3493e298880c2d3fba6a55.png)
Restrict user access to a PDF file
JPedal makes it very easy for Java Developers to remove any Viewer functionality, locking down access and preventing access to the PDF files.
- Disable printing
- Keep document in memory
- Prevent text copying
- Disable load and save
- Add custom operations
- Remove any menu option or button
Customise Viewer Appearance
JPedal makes it very easy for Java Developers to change the Look and Feel Used.
- Change colours
- Different fonts
- Prevent/change pop-up messages
- Unique icons
- Internal Frame
- Menu text