Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Direct printing from JRI and Apex #21

Hi,

how to print directly to printer?
I have set p_print_enabled to true in parameters and configuration file, but I suppose that problem is in not knowing default printer name on client.
If that is the reason, how to obtain this information in Apex or JRI?

xlib_jasperreports.show_report (
p_rep_name => apex_util.url_encode('somereport'),
p_data_source => apex_util.url_encode('default'),
p_print_is_enabled => true,
p_print_printer_name => ''
p_print_duplex => true
);

I am using:
APEX 20.1.0.00.13
JRI 2.6.2-6.15.0
Tomcat 9.0

#2

Hi @miki720 ,

direct printing will send the document to a printer that is CONNECTED TO THE APPLICATION SERVER, not the client browser.

In order to see the names that are known to the application server, go to the Tomcat directly: http://vm1:8080/jri/

Then click on "Printer Diagnostics"

Greenshot 2021-02-24 12.07.59.png

This will open the next page: http://vm1:8080/jri/printerDiagnostics.jsp

Here you can see the names of the printers:

Greenshot 2021-02-24 12.09.20.png

Cheers
~Dietmar.

miki720 · Author
#3

Thank you for explanation Dietmar and thank you for your awesome JRI :)

#4

hello @daust
how to print directly to printer?

the printer is already installed on the server ... no error appears but does not print

Can you help me?

This my code to printg :

XLIB_JASPERREPORTS.SHOW_REPORT(P_REP_NAME => I_NOMBRE_REPORTE,
P_REP_FORMAT => NVL(V_TIPO_FORMATO_REP,
'pdf'),
P_DATA_SOURCE => 'default',
P_OUT_FILENAME => NULL,
P_REP_LOCALE => 'es_ES',
P_REP_ENCODING => 'UTF-8',
P_ADDITIONAL_PARAMS => L_ADDITIONAL_PARAMETERS,
P_PRINT_IS_ENABLED => TRUE,
P_PRINT_PRINTER_NAME => 'Samsung',
P_PRINT_MEDIA => 1,
P_PRINT_COPIES => 1,
P_PRINT_DUPLEX => TRUE,
P_PRINT_COLLATE => TRUE,
P_SAVE_IS_ENABLED => FALSE,
P_SAVE_FILENAME => I_NOMBRE_REPORTE,
P_REP_TIME_ZONE => NULL
);

#5

Hello Dietmar

I have the same problem, the report is probably executed, but after that nothing happens. The service seems to hang. Do you have any ideas how to get this to run?

best thanks and greetings
Charly

#6

Hi @LSoriana,

please pardon my late response.

Did you figure it out?
If not, please do also post a screenshot of the output from the printer diagnostics.
Also, check the logfile on the Tomcat, i.e. catalina.out, if you can see anything there.

Thank you
~Dietmar.

#7

Hi @charlyschmid,

with that little information, it is really hard to troubleshoot. Could be so many different issues, even typos.

Typically, the report is sent to the queue ... things can go wrong from there.

In order to troubleshoot, I would

  • try using a wrong printer name and see whether this throws an error or not
  • check the printer queue on the application server to see, whether the document is in the queue or not.

Best
~Dietmar.

#9

Dear Dietmar,

Thanks for the wonderful JRI interface!

I face the same issue on my project , autoprinting is not happening though we select printisenabled as yes and pasted the printername as displayed in the printerdiagnostics option.

Appreciate if you can guide me to resolve this autoprinting issue.

Thanks,
Fayas.

#10
#11

Hi Fayas,

great, that you could figure it out yourself.

Yes, you also have to activate the printing in the application.properties file as well (this is done for obvious security reasons):

#====================================================================
# Direct printing
#====================================================================
[directPrinting]
isEnabled=false

I have also created an issue for that in order to make it more transparent: https://github.com/daust/JasperReportsIntegration/issues/95

Best
~Dietmar.

#12

Hi! Is there a way to print directly without showing the report in another browser tab? Maybe it exists but I couldn't find it

#13

Sure, just call

xlib_jasperreports.get_report(...);

without displaying the blob.

The get_report() call will simply return the generated file as a BLOB.
Best
~Dietmar.