jPDFPrint Source Code Samples
Following are a number of Java samples that use jPDFPrint to print PDF documents.
SimplePrint.java – A simple program that prints a PDF document.
SimplePrintDefault.java – A program that prints silently a PDF document to the default printer.
SimplePrintNamed.java – A program that prints silently a PDF document to a named printer.
PrintWithAttributes.java – A sample program that prints a PDF document using some of the print request attributes available in Java.
Watermark.java – A program that uses jPDFPrint to print a PDF document and adds a watermark on every page.
CoverPage.java – A program that uses jPDFPrint to print a cover page before printing the rest of the document.
PDFPrintCLI.java – A command line program that takes a number of parameters, such as the printer name, shrink to page and others and then prints a PDF document.
PrintJobListener.java – A program that uses the javax.print.DocPrintJob related classes to print a document. The class registers itself as a javax.print.event.PrintJobListener to receive events related to the progress of the print job.
MultiPrintPageable.java – A class that can print multiple PDF documents as a single print job. The class takes a list of PDF documents, creates a PrinterJob and then uses jPDFPrint to print the documents.
PDFToPS.java – A program that uses jPDFPrint to convert a PDF file to Postscript. The program queries the JVM for any print services that support Postscript output (at least one such services is always available in a Sun JVM) and then prints the document, using jPDFPrint, to that print service.
OverrideMargins.java – A program that sets its own margins and then tells jPDFPrint to print within those margins.
ListPrinters.java – A small utility class that lists the printers as seen by Java. This class is useful because in some cases, Java shows a different name for a printer than the one reported by the operating system.
If you are looking for sample source code for a function that you don’t see here, please let us know at support@qoppa.com and we can see if we have some available internally or if we can produce it for you.