How to Print PDF Files in Java
Printing PDF files is built into JPedal. Java offers a generic printing solution called Java Printing Services and JPedal extends this to add print support to Java.
What can it do?
Print PDF files as high quality output both with or without user interaction. It offers all the PDF print modes available in Acrobat (there are over 50 combinations).
- Client PDF printing with user-selectable options
- Server PDF printing with no user intervention
- Optimisations for PCL printers
- Define multiple page sizes
- Multiple scaling options (no scaling, rotate and fit to page, scale to paper size)
- Print ranges of PDF pages, only odd, only even pages
- Standard Java printing dialog or custom ‘Acrobat-style’ PDF print dialog
- Modes to use Java fonts for standard fonts to speed-up PDF printing and improve quality on low resolution devices.
- Replace PDF form components in printing with your own customised version
List of code examples
The links below provide links to Javadocs and the complete example source code. So you can run directly from the jar or reuse the code in your own programs and tailor it to your exact requirements.
- PrintPdfPages – Javadoc link and Source code provides an example on how to print PDF files automatically from Java.
- Viewer example – Javadoc link and Source code also includes code for PDF printing and contains a custom printDialog
- Custom printDialog – Javadoc link and Source code with access to all the PDF print functionality.
PDF Printing tutorials
The tutorials show you how to easily add Print PDF capabilities to your Java software and customise it with JPedal.
PDF Printing In Java. A simple tutorial to show how you can print PDF files with JPedal.
PDF Print FAQ lists common questions about printing and tips.