OK, thanks.

Aaron

On Sat, Mar 11, 2023 at 2:32 PM Tilman Hausherr <[email protected]>
wrote:

> No it's not supported. Duplex could be implemented easily (it is
> implemented in PDFDebugger), but tray is a lot IMHO.
>
>
> https://docs.oracle.com/javase/7/docs/api/javax/print/attribute/standard/MediaTray.html
>
> the best would be you take the source code and adjust PrintPDF yourself.
> Here's the complete code segment in PDFDebugger:
>
> PrinterJob job = PrinterJob.getPrinterJob();
> job.setPageable(new PDFPageable(document, Orientation.AUTO, false,
> PrintDpiMenu.getDpiSelection()));
> PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
> PDViewerPreferences vp =
> document.getDocumentCatalog().getViewerPreferences();
> if (vp != null && vp.getDuplex() != null)
> {
>      String dp = vp.getDuplex();
>      if
> (PDViewerPreferences.DUPLEX.DuplexFlipLongEdge.toString().equals(dp))
>      {
>          pras.add(Sides.TWO_SIDED_LONG_EDGE);
>      }
>      else if
> (PDViewerPreferences.DUPLEX.DuplexFlipShortEdge.toString().equals(dp))
>      {
>          pras.add(Sides.TWO_SIDED_SHORT_EDGE);
>      }
>      else if (PDViewerPreferences.DUPLEX.Simplex.toString().equals(dp))
>      {
>          pras.add(Sides.ONE_SIDED);
>      }
> }
> //pras.add(new PrinterResolution(300, 300, PrinterResolution.DPI));
> if (job.printDialog(pras))
> {
>      setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
>      try
>      {
>          long t0 = System.nanoTime();
>          job.print(pras);
>          long t1 = System.nanoTime();
>          long ms = TimeUnit.MILLISECONDS.convert(t1 - t0,
> TimeUnit.NANOSECONDS);
>          LOG.info("Printed in " + ms + " ms");
>      }
>      finally
>      {
>          setCursor(Cursor.getDefaultCursor());
>      }
> }
>
>
> Tilman
>
> On 11.03.2023 20:18, Aaron Mulder wrote:
> > Is there a way to use the PrintPDF command-line tool and force it to use
> > duplex and a specific paper tray?  These options are available via lpr
> (I'm
> > on a Mac).  I have been printing PDFs via lpr but there's a new printer
> and
> > maybe 5% of jobs fail to print (the printer says "cancelling job" in the
> > middle of the print and aborts) but those same PDFs print OK with the
> > PrintPDF CLI.  I just want to force the paper tray and duplex settings to
> > be sure it doesn't e.g. pick the wrong tray if the intended one is empty.
> >
> > lpoptions below if it helps.
> >
> > Thanks,
> >        Aaron
> >
> > ColorModel/Color Mode: *Gray
> > cupsPrintQuality/Quality: *Normal
> > Duplex/2-Sided Printing: None *DuplexNoTumble DuplexTumble
> > PageSize/Media Size: 215x345mm 3x5 A4 A5 A6 Env10 EnvC5 EnvDL EnvMonarch
> > Executive FanFoldGermanLegal ISOB5 Legal *Letter Oficio
> Custom.WIDTHxHEIGHT
> > MediaType/MediaType: stationery stationery-lightweight
> > stationery-heavyweight envelope envelope-heavyweight envelope-lightweight
> > labels stationery-bond stationery-colored stationery-letterhead *any
> > InputSlot/Media Source: auto by-pass-tray tray-1 tray-2
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to