Lion Soft Inc.

Excel Reporting Solution Provider

  • Home
  • Products
    • Tools for Oracle Reports
      • Rep2excel
      • Rep2excel Server
      • RepExpert
    • EasyHA Monitoring Tools
    • GTD Excel Report Server
    • Command Line Send Email Component
    • Rapid Word/PDF Reporting Tool
  • Purchase
    • Rep2excel & Rep2excel Server
    • RepExpert
  • FAQ
    • Rep2excel & RepExpert
    • EasyHA
  • Blog
    • Excel Reporting
    • Monitoring
    • Rep2excel

True Silent Printing PDF on Web based Application

June 23, 2016 williamsvoon GTD Printing Tool

Silent Printing on client’s printer is considered to be security hazard and is not recommended to general applications. It would not sound great when you are browser a web page, the browser sending document to your printer without your confirmation.

But with advanced web applications, other than regular websites, such as your web based CRM application, there are requirements for silent printing. The users don’t like clicking the buttons to start printing time and time again.

I came across such requirement recently where I need to print a pdf report generated by Jasper to client computer silently. I am discussing here the example code snippets for this mechanism. The example discussed here uses GTD Printing Tools. This example elaborates the method of sending pdf directly to a printer from the web server without opening it into clients Acrobat Reader. This example has been tested successfully on Windows 8 with IE11 and Acrobat Reader DC.

How it works.

  1. Send request to web server, the server will generate to PDF report.
  2. The web server returns web page with the link to PDF file generated on step 1.
  3. The web page returned on above contains script written with Javascript, it will send the request to local GTD Printing Tools Web Server automatically (http://localhost:47865/), and the link to PDF file is passed to GTD Printing Tools as a parameter.
  4. GTD Printing Tools received the link, and cookie if exists, and send request to web server, by this means to download the PDF file.
  5. Web page return content of the PDF file, GTD Printing Tool will save it to temporary file.
  6. The GTD Printing Tool call Acrobat Reader, send PDF to printer.
  7. The GTD Printing Tool returns an html page to browser, direct the browser to web server.

The user just need to click submit button on step 1, and then the pdf report will be printed silently.

Quick start

Now let’s spend 5 minutes, and test this solution.

1. Download and install GTD Printing Tool.

The GTD Printing Tool can be downloaded from this link:

https://www.lv2000.com/products/setupGtdPrintTool.zip

After download the installer, please unzip the file and double click the installer, the wizard will guide you through the installation.

After install the software, start the program by click button in start menu.

It may take a long time to start the program because it need time to collect data of printers, especially network printer.

The main window is shown below:

Please click “Setting” memu, “Print PDF Configuration…” button, a dialog appear, and then enable PDF printing.

GTD Printing Tool support 4 types of printing software till now.

 

2. Visit www.lv2000.com, it works as web server in this example.

 

Please point your browser to https://www.lv2000.com/gtd-printing-sample/print-pdf.php

The web page looks like this:

The PDF file can be downloaded from this link: https://www.lv2000.com/gtd-printing-sample/getpdf.php

The getpdf.php script will return the report output in PDF format.

You should please login first, otherwise you are not permitted to download the report output, the PDF file. The getpdf.php script will check whether you are authorized to download the PDF file.

This page contains a form. The HTML source code of the form is listed below:

<form action="http://localhost:47865/printdoc" method="post" >
  Path of document: <input type="text" name="docPath" id="docPath" value="http://localhost/gtd-printing-smp/getpdf.php" size="80"/><br>
  Report Name:<input type="text" name="reportName" value="sample"/><br>
  Navigate to this page after printing:<input type="text" name="navigateTo" id="navigateTo" value="" size="80"/><br>
  <input type="hidden" name="cookie" id="cookie" value=""/>
  <input type="submit" value="Print"/>
  </form>
  </p>

  <script>
   document.getElementById("docPath").value= window.location.href.substring(0,window.location.href.lastIndexOf("/"))+"/getpdf.php";
   document.getElementById("navigateTo").value=window.location.href;
   document.getElementById("cookie").value=document.cookie;
  </script>

When you click the Print button, the following information will be sent to GTD Printing Tool Web Server.

Path of document: The URL of the PDF file.

Report Name: The name is used to create rules on client computer.

navigateTo: When you submit the printing job, you might want the browser navigate to web page of your own application. You can specify the URL here.

Cookie: Used to download PDF file. For example the link https://www.lv2000.com/gtd-printing-sample/getpdf.php requires session, so your browser should pass the cookie to GTD Printing Tools.

 

3. Invoke GTD Printing Tool to print PDF.

Now please click the Print button, and then the pdf will be printed to default printer.

How it works

1. Your browser will post the form to GTD Printing Tool Web Server (URL: http://localhost:47865/printdoc ) when you click the Print button. The link to PDF file will be passed to GTD Printing Tool.

2. GTD Printing Tool Web Server receives the request, and then downloads the PDF file.

3. After the PDF file downloaded, GTD Printing Tool will choose printer according to report name (Named “sample” in the example). If no rule associated with report name, it will choose default printer.

4. Call Acrobat Reader to print pdf file.

5. The browser will navigate to next page you specified. In this example, the page is https://www.lv2000.com/gtd-printing-sample/print-pdf.php

 

4. Setup printer for specified report.

 

1. Right click the task. Select “Specify default printer for report xxxx …”

2. Select printer and click OK to save.

True silent printing

 

In the example above, you click the Print button and submit form to GTD Printing Tool Web Server. This click is unnecessary!

The form can be submitted automatically by javascript.

If you have login, you will see this link: https://www.lv2000.com/gtd-printing-sample/print-pdf-one-stop.php

Please try it!

When you invoke the print-pdf-one-stop.php from clients machine it would send a print command to clients printer as soon as the returned page displayed in your browser.

Source code of above php scripts

The source code can be found in GTD Printing Tool installation pack. Generally speaking the folder path is C:\Program Files\GTD Printing Tool\gtd-printing-sample

Print report from your html page without ActiveX add-on

May 27, 2016 williamsvoon GTD Printing Tool

If you are developer of web-based application (browser/server architecture), you may have trouble on printing invoice, ticket etc. The users need to select printer, paper size, and setup the margins, so the user need to click many times.

How to print invoice without selecting printer, paper size etc.? Can I control the printer just by Javascript? Here I will introduce a dedicated printing tool for web page only.

It is GTD Printing Tool, developed by Lion Soft.

Now I will show you the main function by an example.

Download and Install

The GTD Printing Tool can be downloaded from this link:

https://www.lv2000.com/products/setupGtdPrintTool.zip

After download the installer, please unzip the file and double click the installer, the wizard will guide you through the installation.

Run GTD Printing Tool

Please click the shortcut in start menu, run the GTD Printing Tool, it may take a long time to start the program because it need time to collect data of printers, especially network printer.

The main window is shown below:

 

Please click Help, and then Print Sample Web Report…

The browser will be launched.

Please click submit button, and the browser will send request to GTD Printing Tool, and then GTD Printing Tool will print the report. You need to select printer first.

After print the report, the browser will navigate to index page again; you can please fill in another name and print again.

The printing record will be shown in the main window.

GTD Report Designer

 

You can right click the record, and then check the report template in GTD Report Designer.

Support & Feedback

GTD Printing Tool supports all browsers, it can be invoked by any programming language. We will provide sample written in php and java only.

Feedback, questions and bug reports are welcome and please send to support@lv2000.com.

 

How to send email from command line through Gmail or hotmail account in windows

September 16, 2015 williamsvoon Command Line Email

Introduction

Your applications may generate reports and log files every day. And you may get asked by managers is "couldn't you just email that report to me?"

The most popular email client in Windows is Microsoft Outlook, however, it does not support command line.

Can I send email just through command line in Windows? If so, I can send email by batch file, and the email can be sent by schedule task.

This How-To describes using CmdEmail Pro and a gmail/hostmail account to extend the automatic generation of reports and send the reports and any files to your manager.

Steps

1. Download CmdEmail Pro from this link:

https://www.lv2000.com/products/cmdemailpro.zip

2. CmdEmail Pro Edition Usage

    Command Line Send Email Component (version 2.6)
Usage: sendmail [-to:] [-i:] [-a:]
  -to:<recipients>   Specify the recipients
  -m:<file path>     Specify the file contains message to be sent
  -user:<user name>  Specify the user name used to login SMTP server
  -pwd:<password>    Specify the password used to login SMTP server
  -a:<file path>     Specify the file to be attached with the mail
  -compress          Compress the attachments.
  -zippwd:<password> Specify password used to protect the zip file.
  -subject:<subject> Specify the subject.
  -body:<the body>   Specify the message body.
  -html              Send mail in html format.
  -firstline:<first line> Insert the first line before body.
  -setup             Change email account settings etc.

3. Setup your email account.

Before send email, you should have an email account. In this article, we use the free Gmail account. You are better off using your own business email account, and the smtp server is owned by your company.

Please run sendmail.exe -setup

Fill in account information and click OK.

Note:

Your Name: Name of sender

Email Address: Email address of sender

Outgoing SMTP Server: Name or IP address of the SMTP server. For example: smtp.live.com

Server requires authentication: check it in most case, because most smtp server requires authentication.

SSL/TLS enabled: Instructs the program to send the email using SSL. Using the ssl switch can often solve problems where the server expects a STARTTLS command.

User Name and password: User name and password used for authentication. The pasword will be encrypted and saved to file system.

 

  4. Run command line to send email.

sendmail.exe -to:name@example.com -subject:"test message" –a:c:\path\report.txt

Advanced

Compress the attachment

Please append -compress to the command line, the CmdEmail will compress the attachment before send it.

Specify more parameters

In case you want to specify more parameters, for example, send copy to other recipients, please create a message file, and pass the path of the file by command line.

There is a empty line between header and body. The following is an example:

to:scott@tiger.com
cc:bill@microsoft.com
subject:hello scott
attachment:https://www.lv2000.com/sendmail.htm

First line of the body.
Second line.

Save the text above to C:\temp_name.txt . Run CmdEmail again, e.g.

sendmail -m:c:\temp_name.txt

CmdEmail will read information from the message file, then send a mail to sott@tiger.com, copy to bill@microsoft.com .

Send rich format email

Please append -html to the command line. To get more information please view the document of CmdEmail.

 

About the TimeOut directive in Apache configuration file

September 10, 2015 williamsvoon Rep2excel

Rep2excel is tool that can convert oracle reports in to native Microsoft excel format. The Win32-Rep2excel support CGI interface, and then customer deploy it in cgi-bin folder of Apache server. The Rep2excel can be called by other computers via browser, and return the excel file.

HTTP 500 Error

Some customers report problem when Rep2excel converts large oracle report file. In the browser, the end users see the http 500 error page:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, user@domain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

The administrator of apache check the error log, it shows message similar to:

[Tue Sep 08 16:19:53 2015] [error] [client 172.27.67.113] Premature end of script headers: Rep2excel.exe, referer: http://server-name/cgi-bin/rep2excel.exe?job=getwebpage&pagename=index

Troubleshooting

 

First I suggest the users run Rep2excel by command line, and convert the same oracle report file. If the excel file is generated without error, and it takes more than 5 minutes to generate the excel file, you are better off configuring the TimeOut directive in httpd.conf of Apache server.

TimeOut Directive

Description:

Amount of time the server will wait for certain events before failing a request

Syntax:

TimeOut seconds

Default:

TimeOut 300

Context:

server config, virtual host

Status:

Core

Module:

core

The TimeOut directive defines the length of time Apache will wait for I/O in various circumstances:

  1. When reading data from the client, the length of time to wait for a TCP packet to arrive if the read buffer is empty.
  2. When writing data to the client, the length of time to wait for an acknowledgement of a packet if the send buffer is full.
  3. In mod_cgi, the length of time to wait for output from a CGI script.

Solutions

  1. Edit httpd.conf, the file is available in conf folder, for example: C:\Program Files\Apache Software Foundation\Apache2.2\conf
  2. Add timeout=1500 to httpd.conf under server or virtual host context. 1500 means 25 minutes, please increase it as per your needs.
  3. Save httpd.conf and restart Apache.

Other solution

 

The java edition of Rep2excel runs 5-10 times faster than Win32-Rep2excel. You can upgrade to java-Rep2excel in case your oracle report file is very large, or you want to save time.

 

The java-Rep2excel works on Windows, Linux and Unix.

How to run java-rep2excel as Windows service

August 24, 2015 williamsvoon Monitoring

The java-Rep2excel is web-based application, although you can control it via Win32 GUI application. You may want the java-Rep2excel to be running even though you log off the Windows desktop. So you need to run java-Rep2excel as service.

 

How TO

The following steps guide you through the installation of Windows service.

 

  1. Open java-Rep2excel GUI manager, click Server, and then “Install/Uninstall Service”.
  2. The service will be installed. And in case the server has been installed before, and the server will be uninstall if you click the button again.
  3. Run services.msc, you will see the entry of java-rep2excel server in the list of service (local). You can start/stop the service by this command:

 

net start “j-Rep2excel Server”

net stop “j-Rep2excel Server”

 

Note

Please upgrade the version 1.60 or above in case you need the feature. Because there is bug in the version prior to version 1.60.

 

 

Oracle tablespace growth and usage monitoring by EasyHA

August 13, 2015 williamsvoon Monitoring

I want to create a mechanism to monitor growth of our oracle tablespaces and how much space is used in them. 

Step by Step Guide

1. Configure JDBC connections.

Provided you have install the free version of EasyHA, before you monitor your databaseDescription: build-conn-helper.pngs and business data (like tablespace usage), you should please create JDBC database connection to your Oracle database.

To create JDBC connection, please click “Setup” menu, and then click “Databases Overview” button. In the “Jdbcs” page, please click “Add Jdbc” button.

The “New Jdbc” form appears, it is very easy to fill in the form. You can also click “Help” link if you don’t know how to fill in URL box.

 

Now I have created a connection named gnbsprd-ozq. The settings of the connection is listed below:

2. Create item that will monitor your tablespace usage.

  1. Click “Items” menu.
  2. Now you will see the list of items.
  3. Click “Add Item” button in right upper corner.
  4. Select “Biz Data Monitor” from item type list.
  5. Select DB and fill in the SQL statement.
  6. Fill other fields like interval and description of field #1.
  7. Submit the form and review the item. The item looks like this:

 

The SQL statement is very critical.  This is sample SQL.

SELECT 
  D.TOT_GROOTTE_MB "SIZE MB",
  D.TOT_GROOTTE_MB – F.TOTAL_BYTES "USED SPACE MB"
  FROM (SELECT TABLESPACE_NAME,
  ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
  ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
  FROM SYS.DBA_FREE_SPACE
  GROUP BY TABLESPACE_NAME) F,
  (SELECT DD.TABLESPACE_NAME,
   ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
  FROM SYS.DBA_DATA_FILES DD
    WHERE dd.TABLESPACE_NAME='TABLESPACE1'
  GROUP BY DD.TABLESPACE_NAME) D
  WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY 1

If you want to monitor specified table, for example named “emp”, the sql like:

SELECT SUM(bytes)/1024/1024 Mbytese
  FROM dba_segments
 WHERE tablespace_name ='TABLESPACE1'
   AND SEGMENT_NAME='EMP'
    ORDER BY Mbytese DESC

3. View the tablespace growth a few days later.

  1. Click “View” manu.
  2. Click “Graph View” button.
  3. Select item, and fill in date range, and click submit button.

The graph looks like:

Call RepExpert by Http Link

August 12, 2015 williamsvoon Rep2excel

Perhaps you are using web-based oracle reports. Generally speaking, you will call Oracle Reports Server from your Web-based Oracle Forms or other application, the oracle form (or your application) will open the http link, then the default browser of client computer will open the link, and the report output is displayed in browser. The http link looks similar to:

  • http://server-name:7777/dev60cgi/rwcgi60?….
  • http://server-name/reports/rwservlet/getjobid….

As RepExpert is professional printing tool for oracle reports. So you are better off using RepExpert as default viewer/printer of Oracle Report output.

The RepExpert can be launched by web-based forms and web pages.

How it works

The RepExpert contains an add-on for IE named RepExpert IEHelper, you can see this add-on in IE.

Repexpert IEHelper add-on will monitor the navigation activity of IE (Internet Explorer), and analyze the URL and determine whether the URL is link to a file of report output.

If the URL contains all pre-defined keywords, the Repexpert IEHelper add-on will execute RepExpert and it will download the file and open it instead of IE.

Requirements

1. The default browser should be IE (Internet Explorer v6/7/8/9/10/11).
2. The RepExpert IEHelper add-on should be enabled.
3. The URL should contain predefined keywords.

 

Configure RepExpert to be launched by URL

There are 2 ways to configure RepExpert to be launched by URL.

Description: https://www.lv2000.com/re/help/images/star_on_sm_2.gifNo. 1

1. Execute RepExpert, Click Settings Menu -> URL Keywords Setup -> Group #1/2/3/4

Description: https://www.lv2000.com/re/help/helpimg/keyword-setup.jpg

2. Fill in your keywords.

The keyword is sub-string of the URL, it can be used to identify the URL to oracle report output.

3.Click OK.     

To disable one group of keywords, please clear all keywords and click OK.

Description: https://www.lv2000.com/re/help/images/star_on_sm_2.gifNo. 2

The RepExpert contains a built-in keyword: &callrepexpert=yes. So every URL contains this keyword will be used to invoke RepExpert.

So, please just append &callrepexpert=yes to your URL, and then the URL can launch RepExpert.

See the sample below:

declare
v_url varchar2(1000);
begin
v_url:='http://SVR_NAME:7777/dev60cgi/rwcgi60?';
v_url:=v_url||'server=rep_svr&report=test_report.rdf';
v_url:=v_url||'&userid=scott/tiger@test&destype=cache&desformat=HTMLCSS';
v_url:=v_url||'&callrepexpert=yes';
web.show_document(v_url,'_blank');
end;

Troubleshooting

A.

First, please make sure that the IE is default browser of client computer. If you are using Windows 8 or above, please set IE as default browser, other than Microsoft Edge.

B.

If the RepExpert is not launched as you want, you should first check the keyword settings.

The following link contains built-in keyword "&callrepexpert=yes", please click it.

https://www.lv2000.com/examples/getreport.php?file=00001.htm&mime=text/html&callrepexpert=yes

If you want to know whether Repexpert IEHelper works properly, please download the tool from https://www.lv2000.com/products/IeHelperSts.zip

The file is helpful for you diagnosing the error.

How to set Internet Explorer as the default browser:

Internet Explorer is the default browser on Windows computers. If you click a link in another program on your computer, like an email client, it will open in Internet Explorer. If you've set another web browser as the default, you can choose to switch back to Internet Explorer.

  1. Click the Tools button in the top-right corner of the browser, then select Internet Options.Description: screenshot of Internet Explorer 11
  2. The Internet Options dialog box will appear. Select the Programs tab.
  3. Locate and select Make Internet Explorer the default browser, then click OK. Any link you open on your computer will now open in Internet Explorer.

FAQ

Q: Does RepExpert support Windows 10?

A: RepExpert supports Windows 10 (both 32 & 64bit). However, the default browser should be set as Internet Explorer (IE). Perhaps you use Microsoft Edge as default browser.

 

Q: Does RepExpert support IE11?

A: Yes.

 

Q: Does RepExpert support other browser except for IE? Such as Chrome and firefox.

A: Not support other browser till now. You can also contact the vendor support@lv2000.com if you have any special needs. We will develop new features according the customer’s needs.

Configure Microsoft Access Database In GTD Excel Report Server

July 24, 2015 williamsvoon Excel Reporting

The GTD Excel Report Server supports MS-Access DB. You can configure it through Advanced Mode.

 

The sample below is based Windows platform. If your GTD Server is running on Linux, please contact the vendor.

 

Step by step guide:

  1. In the Data Source Manager, please hit the link New Data Source (Advanced Mode)…

  1. The form appears, please fill in the form.

Driver: Must be sun.jdbc.odbc.JdbcOdbcDriver

       URL: Here are 2 samples:

jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=d:/temp/db1.mdb

d:/temp/db1.mdb is path of access data file.

jdbc:odbc:StudentManger

StudentManger is name of your ODBC datasource.

User Name: sa or dba, the field is not critical.

      Password: the password of DB.

 

  1. Submit the form, and move forward.

 

Recent Posts

  • True Silent Printing PDF on Web based Application
  • Print report from your html page without ActiveX add-on
  • How to send email from command line through Gmail or hotmail account in windows
  • About the TimeOut directive in Apache configuration file
  • How to run java-rep2excel as Windows service

Archives

  • June 2016
  • May 2016
  • September 2015
  • August 2015
  • July 2015

Categories

  • Command Line Email
  • Excel Reporting
  • GTD Printing Tool
  • Monitoring
  • Rep2excel

Contact us

To contact our sales office regarding product/pricing inquiries, please send email to sales@lv2000.com.

You can also click the link below to send us message quickly.

Menu

  • Send us a message

Support

Feedback, questions and bug reports are welcome.
Customer support: support@lv2000.com.

Archives

  • June 2016
  • May 2016
  • September 2015
  • August 2015
  • July 2015

Categories

  • Command Line Email
  • Excel Reporting
  • GTD Printing Tool
  • Monitoring
  • Rep2excel

Recent Posts

  • True Silent Printing PDF on Web based Application June 23, 2016
  • Print report from your html page without ActiveX add-on May 27, 2016
© Lion Soft Inc.