Adsense Ad

Saturday, 29 September 2018

Oracle Forms: Direct Print JavaBean


Feature Overview


Overview
  • Using a JavaBean to get back print features lost in Oracle Reports  when converting to web.
  • Send file directly to printer using link


I. Problem One:
Point Of Sale (POS) clients is slow to print.

After converting reports from client/server to the web environment, OraRRP utility was used to print reports directly to client’s default printer, without being prompted with a print dialog. Even though OraRRP works as advertised, it does not meet the speed required for a POS terminal.

Solution:
In my experience with DirectPrint JavaBean, the time to print a receipt reduced from 12 – 14 seconds to 2 - 3 seconds. Also, DirectPrint JavaBean is downloaded and cached to the client machine when client accessed form that calls for DirectPrint JavaBean.

II. Problem Two:
OraRRP utility does not allow printing to named client printer.

Because of architectural change from client/server to web, knowledge of the client printers was lost since Report Server resides on the middle tier where knowledge of printers is loaded.

Solution:
With DirectPrint JavaBean, programmers can send PDF report output to named client printer. This feature can also be used to send a single report to multiple client printers that are either local or on the network. The exact printer name is required.

Conclusion:
DirectPrint JavaBean can be used to restore some print features lost when converting reports from a client/server to web environment.

Demo Installation



Purpose: Instruction to install DirectPrint JavaBean Demo.

Software Needed: Oracle 10g Developer Suite - 10.1.2.

Tested: I have tested DirectPrint JavaBean using Microsoft Internet Explorer 11 with Java plugin-1.6.0_27.

Files Needed:
DirectPrintDemo.fmb – A form that demos the DirectPrint JavaBean features.
DirectPrint.java – Java Source
PDFBox-0.7.3.jar
·         Available at http://www.pdfbox.org
·         Used with permission.
FontBox-0.1.0.jar
·         Available at http://www.fontbox.org
·         Used with permission.

Installation:
  1. Open copy DirectPrintDemo.fmx into location listed in FORMS_PATH.
  2. Download the PDFBox-0.7.3.jar and FontBox-0.1.0 .jar
·         Both are available at the URLs listed below respectively.
·         http://www.pdfbox.org
·         http://www.fontbox.org
  1. Extract the DirectPrintDemo.zip to a temporary location
  2. Create a project in Oracle jdeveloper and add the DirectPrint.java to the project
  3. Add pdfbox.jar and fontbox as libraries to the project.
  4. Use the JAR deployment profile to create the DirectPrint.jar
  5. Sign all jars, DirectPrint.jar and PDFBox-0.7.3.jar and FontBox-0.1.0 .jar
·         Both are available at the URLs listed below respectively.
·         http://www.pdfbox.org
·         http://www.fontbox.org
  1. Copy all signed jars to the %ORACLE_HOME%\forms\java 
·         Note: all signed jars need to be added to the archive parameter.
  1. Add configuration section to the formsweb.cfg to match your environment.
[directprint]
width=650
height=500
separateFrame=True
lookandfeel=Generic
serverApp=default
splashScreen=no
form=DIRECTPRINTDEMO.fmx
envFile=default.env
userid=username/password@database
workingDirectory=CHANGETHISVALUE
archive=frmall.jar,DirectPrint.jar,PDFBox-0.7.3.jar,FontBox-0.1.0.jar
  1. Start local forms OC4J engine and the directprint config.
·         http://localhost/forms/frmservlet?config=directprint
  1. Screen shot.



  1. For additional information see the javadoc included the downloaded DirectPrintDemo.zip.

Loading Fonts: Use the SET_TTF_FROM_FS and SET_TTF_FROM_URL to load other fonts that are listed in the PDF.




6 comments:

Unknown said...

hello hasan, i am getting blank form after configuring this direct print form. error of directbean in java console. Can you help me out ?

Nasser said...

Hi Hasan
Honestly nothing is printing neither something work proper
Did you implement this job on your local pc or in server??

Manoj Jordan said...

Hi Hasan
I dont understand step 4.Create a project in Oracle jdeveloper and add the DirectPrint.java to the project
I am not using JDeveloper and i dont have DirectPrint.java file
I am using Forms & Reports 12c
Can u help me for print reports to local printer

ahmed said...

same error with me, i've followed all the steps, it doesn't work maybe because i'm using JRE 1.6 ? which version JRE you're using

Hasan Jawaid said...

I used it functionality to print POS bills.
Please make sure that you all properly signed the given jar files and properly placed in java folder also pass entries in default.env file

Hasan Jawaid said...

Manoj: Leave the jdeveloper part and just placed the given jar file and then signed them