Class Printing


  • public final class Printing
    extends java.lang.Object
    Examples of various different ways to print PDFs using PDFBox.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Printing()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)
      Entry point.
      private static void print​(PDDocument document)
      Prints the document at its actual size.
      private static void printWithAttributes​(PDDocument document)
      Prints using custom PrintRequestAttribute values.
      private static void printWithDialog​(PDDocument document)
      Prints with a print preview dialog.
      private static void printWithDialogAndAttributes​(PDDocument document)
      Prints with a print preview dialog and custom PrintRequestAttribute values.
      private static void printWithPaper​(PDDocument document)
      Prints using a custom page size and custom margins.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Printing

        private Printing()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.awt.print.PrinterException,
                                java.io.IOException
        Entry point.
        Throws:
        java.awt.print.PrinterException
        java.io.IOException
      • print

        private static void print​(PDDocument document)
                           throws java.awt.print.PrinterException
        Prints the document at its actual size. This is the recommended way to print.
        Throws:
        java.awt.print.PrinterException
      • printWithAttributes

        private static void printWithAttributes​(PDDocument document)
                                         throws java.awt.print.PrinterException
        Prints using custom PrintRequestAttribute values.
        Throws:
        java.awt.print.PrinterException
      • printWithDialog

        private static void printWithDialog​(PDDocument document)
                                     throws java.awt.print.PrinterException
        Prints with a print preview dialog.
        Throws:
        java.awt.print.PrinterException
      • printWithDialogAndAttributes

        private static void printWithDialogAndAttributes​(PDDocument document)
                                                  throws java.awt.print.PrinterException
        Prints with a print preview dialog and custom PrintRequestAttribute values.
        Throws:
        java.awt.print.PrinterException
      • printWithPaper

        private static void printWithPaper​(PDDocument document)
                                    throws java.awt.print.PrinterException
        Prints using a custom page size and custom margins.
        Throws:
        java.awt.print.PrinterException