List of usage examples for org.apache.pdfbox.printing Scaling SCALE_TO_FIT
Scaling SCALE_TO_FIT
To view the source code for org.apache.pdfbox.printing Scaling SCALE_TO_FIT.
Click Source Link
From source file:PrintUtil.java
License:Apache License
void print() { PDDocument doc = null;//w w w .j av a 2 s . c om try { doc = PDDocument.load(new File(path)); } catch (IOException e) { e.printStackTrace(); } job.setPrintable(new PDFPrintable(doc, Scaling.SCALE_TO_FIT)); PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet(); attr.add(Sides.DUPLEX); attr.add(MediaSizeName.ISO_A4); System.out.println("Printing =>" + path); try { job.print(attr); } catch (PrinterException e) { e.printStackTrace(); } finally { if (doc != null) { try { doc.close(); } catch (IOException ignored) { } } } }