PrinterJob.lookupPrintServices() returns empty array on Ubuntu 16 system
My test code is as given below
final static Logger LOGGER = Logger.getLogger(App.class);
private static String location = "";
public static PrintService choosePrinter(String printerName)
PrintService services = PrinterJob.lookupPrintServices(); // list of printers
System.out.println("services : " +services);
LOGGER.info("services : " + services);
PrintService printService = null;
//int count = service.length;
/*
for (int i = 0; i < count; i++)
String availablePrinterName = service.getName();
System.out.println(availablePrinterName);
if (service[i].getName().equalsIgnoreCase(printerName))
printService = service[i];
i = count;
*/
PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("services : " +ps.getName());
LOGGER.info("services : " + ps.getName());
if(services != null)
System.out.println("availablePrinter count: " +services.length);
LOGGER.info("availablePrinter count: " + services.length);
for(PrintService service : services)
String availablePrinterName = service.getName();
System.out.println("availablePrinter : " +availablePrinterName);
LOGGER.info("availablePrinter : " + availablePrinterName);
if(service.getName().contains(printerName))
printService = service;
break;
return printService;
public static void main(String args)
try
LOGGER.info("===== PRINT JOB 2 STARTED =======");
Properties prop = getProperty();
String printerName = prop.getProperty("printername");
//String fileLocation = prop.getProperty("filelocation");
String printStatus = prop.getProperty("enableprint");
Double height = Double.valueOf(prop.getProperty("height"));
Double width = Double.valueOf(prop.getProperty("width"));
Boolean enablePrintPageSetup = Boolean.valueOf(prop.getProperty("enablePrintPageSetup"));
// get the property value and print it out
System.out.println("printerName : " + printerName);
System.out.println("printStatus : " + printStatus);
System.out.println("location : " + location);
System.out.println("enablePrintPageSetup : " + enablePrintPageSetup);
System.out.println("width : " + width + ", height" +height);
LOGGER.info("printerName : " + printerName);
LOGGER.info("printStatus : " + printStatus);
LOGGER.info("location : " + location);
LOGGER.info("enablePrintPageSetup : " + enablePrintPageSetup);
LOGGER.info("width : " + width + ", height" +height);
PDDocument pdf = PDDocument.load(new File(location));
PrinterJob job = PrinterJob.getPrinterJob();
// define custom paper
Paper paper = new Paper();
paper.setSize((width*72), (height*72)); // 1/72 inch
paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());
// custom page format
PageFormat pageFormat = new PageFormat();
if(enablePrintPageSetup)
pageFormat.setPaper(paper);
pageFormat.setOrientation(PageFormat.PORTRAIT);
// override the page format
Book book = new Book();
// append all pages
PDFPrintable pdfPrintable = new PDFPrintable(pdf, Scaling.SHRINK_TO_FIT);
book.append(pdfPrintable, pageFormat, pdf.getNumberOfPages());
job.setPageable(book);
//HP LaserJet M1530
PrintService printService = choosePrinter(printerName);
if(printService != null)
if(Boolean.parseBoolean(printStatus))
LOGGER.info("Print enabled ");
job.setPrintService(printService);
job.print();
else
LOGGER.info("Print disbaled ");
else
System.out.println("No PDF printer available.");
LOGGER.info("===== No PDF printer available. =======");
System.out.println("===== PRINT JOB 2 STOPPED =======");
LOGGER.info("===== PRINT JOB 2 STOPPED =======");
catch (Exception e)
// TODO Auto-generated catch block
LOGGER.error("Error : ", e);
e.printStackTrace();
private static Properties getProperty()
Properties prop = new Properties();
try
File jarPath=new File(App_1.class.getProtectionDomain().getCodeSource().getLocation().getPath());
String propertiesPath=jarPath.getParentFile().getAbsolutePath();
System.out.println(" propertiesPath-"+propertiesPath);
prop.load(new FileInputStream(propertiesPath+"/config.properties"));
location = propertiesPath + "/printpdf.pdf";
catch (Exception e)
e.printStackTrace();
LOGGER.error("Error : ", e);
return prop;
This code prints document without issue. my local windows machine and Ubuntu 17 machine. When I used the same code to print its not working in Ubuntu 16.
I am not sure if its any configuration issue. My log is as mentioned below. Any ideas?
log4j:WARN No such property [maxBackupIndex] in test.com.test.CustomFileAppender.
log4j:WARN No such property [maxFileSize] in test.com.test.CustomFileAppender.
log4j:ERROR Could not find value for key log4j.appender.infoLogger log4j:ERROR Could not instantiate appender named "infoLogger".
2018-11-15 21:19:58 INFO App:59 - ===== PRINT JOB 2 STARTED =======
propertiesPath-/home/user01/sw/cc
printerName : Zebra_ZT410_86.3
printStatus : false
location : /home/user01/sw/cc/printpdf.pdf enablePrintPageSetup : false width : 3.97, height5.97
2018-11-15 21:19:58 INFO App:73 - printerName : Zebra_ZT410_86.3
2018-11-15 21:19:58 INFO App:74 - printStatus : false
2018-11-15 21:19:58 INFO App:75 - location :
/home/user01/sw/cc/printpdf.pdf
2018-11-15 21:19:58 INFO App:76 - enablePrintPageSetup : false
2018-11-15 21:19:58 INFO App:77 - width : 3.97, height5.97
2018-11-15 21:19:58 INFO PDDeviceRGB:138 - To get higher rendering speed on JDK8 or later,
2018-11-15 21:19:58 INFO PDDeviceRGB:139 - use the option -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider
2018-11-15 21:19:58 INFO PDDeviceRGB:140 - or call System.setProperty("sun.java2d.cmm",
"sun.java2d.cmm.kcms.KcmsServiceProvider")
services : [Ljavax.print.PrintService;@3b192d32
2018-11-15 21:19:58 INFO App:36 - services :
[Ljavax.print.PrintService;@3b192d32
availablePrinter count: 0
2018-11-15 21:19:58 INFO App:39 - availablePrinter count: 0 No PDF printer available.
2018-11-15 21:19:58 INFO App:117 - ===== No PDF printer available. ======= ===== PRINT JOB 2 STOPPED =======
2018-11-15 21:19:58 INFO App:120 - ===== PRINT JOB 2 STOPPED =======
java pdf printing
add a comment |
My test code is as given below
final static Logger LOGGER = Logger.getLogger(App.class);
private static String location = "";
public static PrintService choosePrinter(String printerName)
PrintService services = PrinterJob.lookupPrintServices(); // list of printers
System.out.println("services : " +services);
LOGGER.info("services : " + services);
PrintService printService = null;
//int count = service.length;
/*
for (int i = 0; i < count; i++)
String availablePrinterName = service.getName();
System.out.println(availablePrinterName);
if (service[i].getName().equalsIgnoreCase(printerName))
printService = service[i];
i = count;
*/
PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("services : " +ps.getName());
LOGGER.info("services : " + ps.getName());
if(services != null)
System.out.println("availablePrinter count: " +services.length);
LOGGER.info("availablePrinter count: " + services.length);
for(PrintService service : services)
String availablePrinterName = service.getName();
System.out.println("availablePrinter : " +availablePrinterName);
LOGGER.info("availablePrinter : " + availablePrinterName);
if(service.getName().contains(printerName))
printService = service;
break;
return printService;
public static void main(String args)
try
LOGGER.info("===== PRINT JOB 2 STARTED =======");
Properties prop = getProperty();
String printerName = prop.getProperty("printername");
//String fileLocation = prop.getProperty("filelocation");
String printStatus = prop.getProperty("enableprint");
Double height = Double.valueOf(prop.getProperty("height"));
Double width = Double.valueOf(prop.getProperty("width"));
Boolean enablePrintPageSetup = Boolean.valueOf(prop.getProperty("enablePrintPageSetup"));
// get the property value and print it out
System.out.println("printerName : " + printerName);
System.out.println("printStatus : " + printStatus);
System.out.println("location : " + location);
System.out.println("enablePrintPageSetup : " + enablePrintPageSetup);
System.out.println("width : " + width + ", height" +height);
LOGGER.info("printerName : " + printerName);
LOGGER.info("printStatus : " + printStatus);
LOGGER.info("location : " + location);
LOGGER.info("enablePrintPageSetup : " + enablePrintPageSetup);
LOGGER.info("width : " + width + ", height" +height);
PDDocument pdf = PDDocument.load(new File(location));
PrinterJob job = PrinterJob.getPrinterJob();
// define custom paper
Paper paper = new Paper();
paper.setSize((width*72), (height*72)); // 1/72 inch
paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());
// custom page format
PageFormat pageFormat = new PageFormat();
if(enablePrintPageSetup)
pageFormat.setPaper(paper);
pageFormat.setOrientation(PageFormat.PORTRAIT);
// override the page format
Book book = new Book();
// append all pages
PDFPrintable pdfPrintable = new PDFPrintable(pdf, Scaling.SHRINK_TO_FIT);
book.append(pdfPrintable, pageFormat, pdf.getNumberOfPages());
job.setPageable(book);
//HP LaserJet M1530
PrintService printService = choosePrinter(printerName);
if(printService != null)
if(Boolean.parseBoolean(printStatus))
LOGGER.info("Print enabled ");
job.setPrintService(printService);
job.print();
else
LOGGER.info("Print disbaled ");
else
System.out.println("No PDF printer available.");
LOGGER.info("===== No PDF printer available. =======");
System.out.println("===== PRINT JOB 2 STOPPED =======");
LOGGER.info("===== PRINT JOB 2 STOPPED =======");
catch (Exception e)
// TODO Auto-generated catch block
LOGGER.error("Error : ", e);
e.printStackTrace();
private static Properties getProperty()
Properties prop = new Properties();
try
File jarPath=new File(App_1.class.getProtectionDomain().getCodeSource().getLocation().getPath());
String propertiesPath=jarPath.getParentFile().getAbsolutePath();
System.out.println(" propertiesPath-"+propertiesPath);
prop.load(new FileInputStream(propertiesPath+"/config.properties"));
location = propertiesPath + "/printpdf.pdf";
catch (Exception e)
e.printStackTrace();
LOGGER.error("Error : ", e);
return prop;
This code prints document without issue. my local windows machine and Ubuntu 17 machine. When I used the same code to print its not working in Ubuntu 16.
I am not sure if its any configuration issue. My log is as mentioned below. Any ideas?
log4j:WARN No such property [maxBackupIndex] in test.com.test.CustomFileAppender.
log4j:WARN No such property [maxFileSize] in test.com.test.CustomFileAppender.
log4j:ERROR Could not find value for key log4j.appender.infoLogger log4j:ERROR Could not instantiate appender named "infoLogger".
2018-11-15 21:19:58 INFO App:59 - ===== PRINT JOB 2 STARTED =======
propertiesPath-/home/user01/sw/cc
printerName : Zebra_ZT410_86.3
printStatus : false
location : /home/user01/sw/cc/printpdf.pdf enablePrintPageSetup : false width : 3.97, height5.97
2018-11-15 21:19:58 INFO App:73 - printerName : Zebra_ZT410_86.3
2018-11-15 21:19:58 INFO App:74 - printStatus : false
2018-11-15 21:19:58 INFO App:75 - location :
/home/user01/sw/cc/printpdf.pdf
2018-11-15 21:19:58 INFO App:76 - enablePrintPageSetup : false
2018-11-15 21:19:58 INFO App:77 - width : 3.97, height5.97
2018-11-15 21:19:58 INFO PDDeviceRGB:138 - To get higher rendering speed on JDK8 or later,
2018-11-15 21:19:58 INFO PDDeviceRGB:139 - use the option -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider
2018-11-15 21:19:58 INFO PDDeviceRGB:140 - or call System.setProperty("sun.java2d.cmm",
"sun.java2d.cmm.kcms.KcmsServiceProvider")
services : [Ljavax.print.PrintService;@3b192d32
2018-11-15 21:19:58 INFO App:36 - services :
[Ljavax.print.PrintService;@3b192d32
availablePrinter count: 0
2018-11-15 21:19:58 INFO App:39 - availablePrinter count: 0 No PDF printer available.
2018-11-15 21:19:58 INFO App:117 - ===== No PDF printer available. ======= ===== PRINT JOB 2 STOPPED =======
2018-11-15 21:19:58 INFO App:120 - ===== PRINT JOB 2 STOPPED =======
java pdf printing
1
This question could be summarized as: “PrinterJob.lookupPrintServices() returns empty array on Ubuntu 16 system.” Did you verify in that system’s printer settings that it actually has one or more printers defined?
– VGR
Nov 15 '18 at 19:04
Updated the question. thanks for the suggestion. To answer the question, Yes We can print manually via command
– arjuncc
Nov 16 '18 at 6:47
This may help: askubuntu.com/questions/860495/…
– VGR
Nov 17 '18 at 17:19
add a comment |
My test code is as given below
final static Logger LOGGER = Logger.getLogger(App.class);
private static String location = "";
public static PrintService choosePrinter(String printerName)
PrintService services = PrinterJob.lookupPrintServices(); // list of printers
System.out.println("services : " +services);
LOGGER.info("services : " + services);
PrintService printService = null;
//int count = service.length;
/*
for (int i = 0; i < count; i++)
String availablePrinterName = service.getName();
System.out.println(availablePrinterName);
if (service[i].getName().equalsIgnoreCase(printerName))
printService = service[i];
i = count;
*/
PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("services : " +ps.getName());
LOGGER.info("services : " + ps.getName());
if(services != null)
System.out.println("availablePrinter count: " +services.length);
LOGGER.info("availablePrinter count: " + services.length);
for(PrintService service : services)
String availablePrinterName = service.getName();
System.out.println("availablePrinter : " +availablePrinterName);
LOGGER.info("availablePrinter : " + availablePrinterName);
if(service.getName().contains(printerName))
printService = service;
break;
return printService;
public static void main(String args)
try
LOGGER.info("===== PRINT JOB 2 STARTED =======");
Properties prop = getProperty();
String printerName = prop.getProperty("printername");
//String fileLocation = prop.getProperty("filelocation");
String printStatus = prop.getProperty("enableprint");
Double height = Double.valueOf(prop.getProperty("height"));
Double width = Double.valueOf(prop.getProperty("width"));
Boolean enablePrintPageSetup = Boolean.valueOf(prop.getProperty("enablePrintPageSetup"));
// get the property value and print it out
System.out.println("printerName : " + printerName);
System.out.println("printStatus : " + printStatus);
System.out.println("location : " + location);
System.out.println("enablePrintPageSetup : " + enablePrintPageSetup);
System.out.println("width : " + width + ", height" +height);
LOGGER.info("printerName : " + printerName);
LOGGER.info("printStatus : " + printStatus);
LOGGER.info("location : " + location);
LOGGER.info("enablePrintPageSetup : " + enablePrintPageSetup);
LOGGER.info("width : " + width + ", height" +height);
PDDocument pdf = PDDocument.load(new File(location));
PrinterJob job = PrinterJob.getPrinterJob();
// define custom paper
Paper paper = new Paper();
paper.setSize((width*72), (height*72)); // 1/72 inch
paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());
// custom page format
PageFormat pageFormat = new PageFormat();
if(enablePrintPageSetup)
pageFormat.setPaper(paper);
pageFormat.setOrientation(PageFormat.PORTRAIT);
// override the page format
Book book = new Book();
// append all pages
PDFPrintable pdfPrintable = new PDFPrintable(pdf, Scaling.SHRINK_TO_FIT);
book.append(pdfPrintable, pageFormat, pdf.getNumberOfPages());
job.setPageable(book);
//HP LaserJet M1530
PrintService printService = choosePrinter(printerName);
if(printService != null)
if(Boolean.parseBoolean(printStatus))
LOGGER.info("Print enabled ");
job.setPrintService(printService);
job.print();
else
LOGGER.info("Print disbaled ");
else
System.out.println("No PDF printer available.");
LOGGER.info("===== No PDF printer available. =======");
System.out.println("===== PRINT JOB 2 STOPPED =======");
LOGGER.info("===== PRINT JOB 2 STOPPED =======");
catch (Exception e)
// TODO Auto-generated catch block
LOGGER.error("Error : ", e);
e.printStackTrace();
private static Properties getProperty()
Properties prop = new Properties();
try
File jarPath=new File(App_1.class.getProtectionDomain().getCodeSource().getLocation().getPath());
String propertiesPath=jarPath.getParentFile().getAbsolutePath();
System.out.println(" propertiesPath-"+propertiesPath);
prop.load(new FileInputStream(propertiesPath+"/config.properties"));
location = propertiesPath + "/printpdf.pdf";
catch (Exception e)
e.printStackTrace();
LOGGER.error("Error : ", e);
return prop;
This code prints document without issue. my local windows machine and Ubuntu 17 machine. When I used the same code to print its not working in Ubuntu 16.
I am not sure if its any configuration issue. My log is as mentioned below. Any ideas?
log4j:WARN No such property [maxBackupIndex] in test.com.test.CustomFileAppender.
log4j:WARN No such property [maxFileSize] in test.com.test.CustomFileAppender.
log4j:ERROR Could not find value for key log4j.appender.infoLogger log4j:ERROR Could not instantiate appender named "infoLogger".
2018-11-15 21:19:58 INFO App:59 - ===== PRINT JOB 2 STARTED =======
propertiesPath-/home/user01/sw/cc
printerName : Zebra_ZT410_86.3
printStatus : false
location : /home/user01/sw/cc/printpdf.pdf enablePrintPageSetup : false width : 3.97, height5.97
2018-11-15 21:19:58 INFO App:73 - printerName : Zebra_ZT410_86.3
2018-11-15 21:19:58 INFO App:74 - printStatus : false
2018-11-15 21:19:58 INFO App:75 - location :
/home/user01/sw/cc/printpdf.pdf
2018-11-15 21:19:58 INFO App:76 - enablePrintPageSetup : false
2018-11-15 21:19:58 INFO App:77 - width : 3.97, height5.97
2018-11-15 21:19:58 INFO PDDeviceRGB:138 - To get higher rendering speed on JDK8 or later,
2018-11-15 21:19:58 INFO PDDeviceRGB:139 - use the option -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider
2018-11-15 21:19:58 INFO PDDeviceRGB:140 - or call System.setProperty("sun.java2d.cmm",
"sun.java2d.cmm.kcms.KcmsServiceProvider")
services : [Ljavax.print.PrintService;@3b192d32
2018-11-15 21:19:58 INFO App:36 - services :
[Ljavax.print.PrintService;@3b192d32
availablePrinter count: 0
2018-11-15 21:19:58 INFO App:39 - availablePrinter count: 0 No PDF printer available.
2018-11-15 21:19:58 INFO App:117 - ===== No PDF printer available. ======= ===== PRINT JOB 2 STOPPED =======
2018-11-15 21:19:58 INFO App:120 - ===== PRINT JOB 2 STOPPED =======
java pdf printing
My test code is as given below
final static Logger LOGGER = Logger.getLogger(App.class);
private static String location = "";
public static PrintService choosePrinter(String printerName)
PrintService services = PrinterJob.lookupPrintServices(); // list of printers
System.out.println("services : " +services);
LOGGER.info("services : " + services);
PrintService printService = null;
//int count = service.length;
/*
for (int i = 0; i < count; i++)
String availablePrinterName = service.getName();
System.out.println(availablePrinterName);
if (service[i].getName().equalsIgnoreCase(printerName))
printService = service[i];
i = count;
*/
PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("services : " +ps.getName());
LOGGER.info("services : " + ps.getName());
if(services != null)
System.out.println("availablePrinter count: " +services.length);
LOGGER.info("availablePrinter count: " + services.length);
for(PrintService service : services)
String availablePrinterName = service.getName();
System.out.println("availablePrinter : " +availablePrinterName);
LOGGER.info("availablePrinter : " + availablePrinterName);
if(service.getName().contains(printerName))
printService = service;
break;
return printService;
public static void main(String args)
try
LOGGER.info("===== PRINT JOB 2 STARTED =======");
Properties prop = getProperty();
String printerName = prop.getProperty("printername");
//String fileLocation = prop.getProperty("filelocation");
String printStatus = prop.getProperty("enableprint");
Double height = Double.valueOf(prop.getProperty("height"));
Double width = Double.valueOf(prop.getProperty("width"));
Boolean enablePrintPageSetup = Boolean.valueOf(prop.getProperty("enablePrintPageSetup"));
// get the property value and print it out
System.out.println("printerName : " + printerName);
System.out.println("printStatus : " + printStatus);
System.out.println("location : " + location);
System.out.println("enablePrintPageSetup : " + enablePrintPageSetup);
System.out.println("width : " + width + ", height" +height);
LOGGER.info("printerName : " + printerName);
LOGGER.info("printStatus : " + printStatus);
LOGGER.info("location : " + location);
LOGGER.info("enablePrintPageSetup : " + enablePrintPageSetup);
LOGGER.info("width : " + width + ", height" +height);
PDDocument pdf = PDDocument.load(new File(location));
PrinterJob job = PrinterJob.getPrinterJob();
// define custom paper
Paper paper = new Paper();
paper.setSize((width*72), (height*72)); // 1/72 inch
paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());
// custom page format
PageFormat pageFormat = new PageFormat();
if(enablePrintPageSetup)
pageFormat.setPaper(paper);
pageFormat.setOrientation(PageFormat.PORTRAIT);
// override the page format
Book book = new Book();
// append all pages
PDFPrintable pdfPrintable = new PDFPrintable(pdf, Scaling.SHRINK_TO_FIT);
book.append(pdfPrintable, pageFormat, pdf.getNumberOfPages());
job.setPageable(book);
//HP LaserJet M1530
PrintService printService = choosePrinter(printerName);
if(printService != null)
if(Boolean.parseBoolean(printStatus))
LOGGER.info("Print enabled ");
job.setPrintService(printService);
job.print();
else
LOGGER.info("Print disbaled ");
else
System.out.println("No PDF printer available.");
LOGGER.info("===== No PDF printer available. =======");
System.out.println("===== PRINT JOB 2 STOPPED =======");
LOGGER.info("===== PRINT JOB 2 STOPPED =======");
catch (Exception e)
// TODO Auto-generated catch block
LOGGER.error("Error : ", e);
e.printStackTrace();
private static Properties getProperty()
Properties prop = new Properties();
try
File jarPath=new File(App_1.class.getProtectionDomain().getCodeSource().getLocation().getPath());
String propertiesPath=jarPath.getParentFile().getAbsolutePath();
System.out.println(" propertiesPath-"+propertiesPath);
prop.load(new FileInputStream(propertiesPath+"/config.properties"));
location = propertiesPath + "/printpdf.pdf";
catch (Exception e)
e.printStackTrace();
LOGGER.error("Error : ", e);
return prop;
This code prints document without issue. my local windows machine and Ubuntu 17 machine. When I used the same code to print its not working in Ubuntu 16.
I am not sure if its any configuration issue. My log is as mentioned below. Any ideas?
log4j:WARN No such property [maxBackupIndex] in test.com.test.CustomFileAppender.
log4j:WARN No such property [maxFileSize] in test.com.test.CustomFileAppender.
log4j:ERROR Could not find value for key log4j.appender.infoLogger log4j:ERROR Could not instantiate appender named "infoLogger".
2018-11-15 21:19:58 INFO App:59 - ===== PRINT JOB 2 STARTED =======
propertiesPath-/home/user01/sw/cc
printerName : Zebra_ZT410_86.3
printStatus : false
location : /home/user01/sw/cc/printpdf.pdf enablePrintPageSetup : false width : 3.97, height5.97
2018-11-15 21:19:58 INFO App:73 - printerName : Zebra_ZT410_86.3
2018-11-15 21:19:58 INFO App:74 - printStatus : false
2018-11-15 21:19:58 INFO App:75 - location :
/home/user01/sw/cc/printpdf.pdf
2018-11-15 21:19:58 INFO App:76 - enablePrintPageSetup : false
2018-11-15 21:19:58 INFO App:77 - width : 3.97, height5.97
2018-11-15 21:19:58 INFO PDDeviceRGB:138 - To get higher rendering speed on JDK8 or later,
2018-11-15 21:19:58 INFO PDDeviceRGB:139 - use the option -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider
2018-11-15 21:19:58 INFO PDDeviceRGB:140 - or call System.setProperty("sun.java2d.cmm",
"sun.java2d.cmm.kcms.KcmsServiceProvider")
services : [Ljavax.print.PrintService;@3b192d32
2018-11-15 21:19:58 INFO App:36 - services :
[Ljavax.print.PrintService;@3b192d32
availablePrinter count: 0
2018-11-15 21:19:58 INFO App:39 - availablePrinter count: 0 No PDF printer available.
2018-11-15 21:19:58 INFO App:117 - ===== No PDF printer available. ======= ===== PRINT JOB 2 STOPPED =======
2018-11-15 21:19:58 INFO App:120 - ===== PRINT JOB 2 STOPPED =======
java pdf printing
java pdf printing
edited Nov 16 '18 at 6:46
arjuncc
asked Nov 15 '18 at 14:21
arjunccarjuncc
2,03343262
2,03343262
1
This question could be summarized as: “PrinterJob.lookupPrintServices() returns empty array on Ubuntu 16 system.” Did you verify in that system’s printer settings that it actually has one or more printers defined?
– VGR
Nov 15 '18 at 19:04
Updated the question. thanks for the suggestion. To answer the question, Yes We can print manually via command
– arjuncc
Nov 16 '18 at 6:47
This may help: askubuntu.com/questions/860495/…
– VGR
Nov 17 '18 at 17:19
add a comment |
1
This question could be summarized as: “PrinterJob.lookupPrintServices() returns empty array on Ubuntu 16 system.” Did you verify in that system’s printer settings that it actually has one or more printers defined?
– VGR
Nov 15 '18 at 19:04
Updated the question. thanks for the suggestion. To answer the question, Yes We can print manually via command
– arjuncc
Nov 16 '18 at 6:47
This may help: askubuntu.com/questions/860495/…
– VGR
Nov 17 '18 at 17:19
1
1
This question could be summarized as: “PrinterJob.lookupPrintServices() returns empty array on Ubuntu 16 system.” Did you verify in that system’s printer settings that it actually has one or more printers defined?
– VGR
Nov 15 '18 at 19:04
This question could be summarized as: “PrinterJob.lookupPrintServices() returns empty array on Ubuntu 16 system.” Did you verify in that system’s printer settings that it actually has one or more printers defined?
– VGR
Nov 15 '18 at 19:04
Updated the question. thanks for the suggestion. To answer the question, Yes We can print manually via command
– arjuncc
Nov 16 '18 at 6:47
Updated the question. thanks for the suggestion. To answer the question, Yes We can print manually via command
– arjuncc
Nov 16 '18 at 6:47
This may help: askubuntu.com/questions/860495/…
– VGR
Nov 17 '18 at 17:19
This may help: askubuntu.com/questions/860495/…
– VGR
Nov 17 '18 at 17:19
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321510%2fprinterjob-lookupprintservices-returns-empty-array-on-ubuntu-16-system%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321510%2fprinterjob-lookupprintservices-returns-empty-array-on-ubuntu-16-system%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
This question could be summarized as: “PrinterJob.lookupPrintServices() returns empty array on Ubuntu 16 system.” Did you verify in that system’s printer settings that it actually has one or more printers defined?
– VGR
Nov 15 '18 at 19:04
Updated the question. thanks for the suggestion. To answer the question, Yes We can print manually via command
– arjuncc
Nov 16 '18 at 6:47
This may help: askubuntu.com/questions/860495/…
– VGR
Nov 17 '18 at 17:19