Class PrintPDF

java.lang.Object
org.apache.pdfbox.tools.PrintPDF
All Implemented Interfaces:
Callable<Integer>

public final class PrintPDF extends Object implements Callable<Integer>
This is a command line program that will print a PDF document.
  • Field Details

    • SYSERR

      private final PrintStream SYSERR
    • password

      private String password
    • silentPrint

      private boolean silentPrint
    • printerName

      private String printerName
    • orientation

      private Orientation orientation
    • duplex

      private PrintPDF.Duplex duplex
    • tray

      private String tray
    • mediaSize

      private String mediaSize
    • border

      private boolean border
    • dpi

      private int dpi
    • noCenter

      private boolean noCenter
    • noColorOpt

      private boolean noColorOpt
    • infile

      private File infile
  • Constructor Details

    • PrintPDF

      public PrintPDF()
      Constructor.
  • Method Details

    • main

      public static void main(String[] args)
      Infamous main method.
      Parameters:
      args - Command line arguments, should be one and a reference to a file.
    • call

      public Integer call()
      Specified by:
      call in interface Callable<Integer>
    • getTraysFromPrintService

      private static List<MediaTray> getTraysFromPrintService(PrintService printService)
    • getMediaSizesFromPrintService

      private static List<MediaSizeName> getMediaSizesFromPrintService(PrintService printService)
    • createPrintRequestAttributeSet

      private PrintRequestAttributeSet createPrintRequestAttributeSet(PDDocument document)
    • toPossibleAlternateMedia

      private Attribute toPossibleAlternateMedia(MediaTray mediaTray)
      Wraps the MediaTray object into a sun.print.SunAlternateMedia class if it exists. This allows to select both tray and paper size when printing.
      Parameters:
      mediaTray - a MediaTray object.
      Returns:
      a wrapped MediaTray object or the original MediaTray object.
    • showAvailablePrinters

      private void showAvailablePrinters()