Environment
My environment is Tomcat7 and I'm using Java 1.8, Windows 10 and I'm using a PDF Reader to test the print. My user is an administrator of the machine.
Problem
I'm trying to send a PDF to print, but this PDF does not print. When the print request arrives in the queue, it is spooled eternally with a blank size.
Printing works if I start Tomcat7 from CMD, if I use services.msc or TomcatW the printout does not work. The difference between the two is the initialization of the user profile in the CMD log Tomcat7 loads C: \ WINDOWS \ system32 \ config \ systemprofile.dnx \ bin and logs using services.msc > C: \ Users \ MY_USER.dnx \ bin
I have discovered that this means permission problems for the print queue, but I can not find a specific reason why my user who is the administrator of the machine can not print. Things I've already tried to solve the problem:
I've already looked at SO in English, including the web, none of the solutions found worked.
Code that I'm using to print: Using PDFBox to load PDF.
PDDocument pdDoc = PDDocument.load(pdfFile);
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintService(service);
job.setJobName("The System Job");
job.setPageable(new PDFPageable(pdDoc));
job.print();
pdDoc.close();
I found a solution using PrintService to create PrinterJob and it still did not work.
service.createPrintJob().print(pdDoc, null);
Does anyone have any solutions to the problem?