How to add the necessary permissions for the Printer Job to work on Tomcat7

Asked

Viewed 49 times

1

Ambience

My environment is Tomcat7 and I am using Java 1.8, Windows 10 and I am using a PDF Reader to test the print. My user is a machine administrator.

Problem

I am trying to send a PDF for printing, but this PDF is not printed. When the print request arrives in the queue, it is in Spooling state eternally with blank size.

Printing works if I start Tomcat7 from CMD, if I use services.Msc or Tomcatw printing doesn’t 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 log using services.Msc C: Users MY_USER.dnx bin

I found that this means permission issues for the print queue, but I can’t find a specific reason why my machine administrator can’t print. Things I’ve tried to solve the problem:

  1. Run Tomcat7 using the Logon option with an Administrator account (including Network Administrator)
  2. Enable "Allow service to Interact with desktop"
  3. Disable Firewall/ Antivirus
  4. Start Tomcat7w with administrator privileges for all users.
  5. Add machine user to 'Log on as service' using gpedit
  6. Change the Java version to 7.
  7. Install/ Uninstall the Tomcat service using a user with Administrator privileges.
  8. Clear Tomcat7 Registration Key (HKEY)

I’ve looked in the ONLY in English and through the web, none of the solutions found worked.

Code I’m using for printing: Using Pdfbox to load the 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 didn’t work.

service.createPrintJob().print(pdDoc, null);

Does anyone have any solution to the problem?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.