How to print an html report?

In a Test UUT's execution, the process model generates and saves a html report. How can add steps to the process model to print the report each time? I'm thinking maybe somehow using an ActiveX call to open IE and then print (1 step or 2?), but I'm a newbie to ActiveX and don't know what server/class/method to use.
==============================================
David Kaufman
LabVIEW Certified Developer
==============================================

Using Microsoft Word could be a good solution if you actually have it installed in the computer. In some cases, you may not want to have that application installed in the production floor for any reason (licenses, memory space...).
I am attaching an example that shows how to print the report automatically after testing a UUT using ActiveX to communicate with Internet Explorer. It is more likely that any machine would have this application installed since it occupies a lot less memory space and it ships with any Windows OS. Furthermore, there are just 3 steps that do the trick!
The attached zip file contains a modified sequential model. The entry points ("Single Step" and “Test UUTs”) have one new step that calls the "Print Report" sequence (also added to the sequential model). This new sequence has ActiveX steps that call two methods of the “Internet Explorer (IwebBrowser2)”object class exported by the “Microsoft Internet Controls” automation server. These two methods are:
1) Navigate. Allows you to select the html file to load.
2) ExecWB with the first parameter (cmdid) set to "OLECMDID_PRINT" (prints the loaded file) and the second parameter (cmdexecopt) set to OLECMDEXECOPT_DONTPROMPTUSER" (don’t show the print dialog).
(For more information about these methods, please refer to the MSDN Library)
The example will print the report after each UUT is tested. The "Print Report" step is set to run just if the Report Generation is not disabled (see its preconditions).
This is what you need to do to run the example:
1) Copy the contents of the zip file to: \Components\User\Models\TestStandModels
2) Make sure that the “User Components Directoty” is checked in the Search Directories.
3) Run any sequence using Single Pass or Test UUTs.
WARNING: There is a known issue when using the printing capabilities of the Internet Explorer. This is what is explained in the MSDN library:
"... Internet Explorer prints in the background. This means that the print processing is actually completed asynchronously in a separate thread.Upon return from ExecWB, the print processing may continue for several seconds or even up to a minute or two based on various factors such as the size of the content and how busy your system is currently. The problem is that if you start a print job and then destroy the WebBrowser or close your application before the background thread finishes processing, the thread will abandon its work and the page may not be completely printed..."
There are 2 approaches to work around this problem:
1) Use a delay before destroying the WebBrowser reference (which is done in the cleanup step group of the "Print Report" sequence in the example). This is the approached used in the example. The third step in the “Print Report” sequence is a Wait step. The step is currently set to wait for 3 seconds which has worked for me for almost any report sizes.
2)In Internet Explorer 5 you can work around this problem by sinking the OnAfterPrint event. If you have started a print job, then you should wait to release the WebBrowser until after this event has been received. If you choose this approach you could use the ActiveX events capabilities of Labview or Visual Basic to create a small program detecting this event. There's a simple sample code provided in the MSDN library for VB.
Enjoy!
Attachments:
SequentialModel.seq ‏169 KB

Similar Messages

  • How to print a html report?

    I have LV 6.1 pro and I want after succesfull generate of html report
    print them. How?

    If you want to print the HTML report, you'll have to use ActiveX to open the resulting report with your web browser and then tell the browser to print it. Of course if you are wanting to print it, why are you using HTML? Why not generate it as a standard report? Or do both--one for printing and one for online publication.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to print out multilingual reports from the main report using Xliff temp

    Hi all,
    How to print out multilingual reports from the main report using Xliff temp?
    When I want main report call subtemplate and finish xliff tranlation
    <?for-each@section:INVOICE?><?end for-each?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    Prints out fine with Finnish translation
    But if I want in main program to check what language is used e.g.
    if trx_number = 142 call Finnish translation and if trx_number =144,
    call English translation.
    <?for-each@section:INVOICE?><?end for-each?>
    <?if:TRX_NUMBER=’142’?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    <?end if?>
    <?if: TRX_NUMBER=’144’?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.US/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    <?end if?>
    Prints out always in English and never the Finnish translation.
    Program goes fine to if branch but does not print out Finnish
    Does anybody know what could be wrong?
    BR
    Kari

    Thanks Amit,
    I have two layout, main-layout and sub-layout
    Main layout call subtemplate
    I have registered layout and xliff-file
    Main template
    Localized Templates
    File Name           Language Territory
    XXNS_INVOICE_MAIN.rtf      English
    SUB template
    Localized Templates
    File Name           Language Territory
    XXNS_INVOICE_SUB.rtf      English
    Translatable Template
    File Name           Language      Territory
    XXNS_INVOICE_SUB.rtf      English      United States
    Available Translations
    Language Territory Progress
    English Finland Complete
    If main report call subtemplate and finish xliff tranlation
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    Prints out fine with Finnish translation
    But if I want in main program to check what language is used e.g.
    if....
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    .....end if;
    if....
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.US/?>
    .....end if;
    Prints out always in English and never the Finnish translation.
    Program goes fine to if branch but does not print out Finnish
    Do you it's set up problem or program problem
    BR
    Kari

  • How to print formatted data / report on user's printer in Web Application

    Hi All
    I want to print some formatted data/report ( it might be 1000 pages) on user's printer.
    application is web based and tech. used are Java - jsp - servlets
    now prob. is ...
    how i will transfer all data to client (web browser) from the server and how i can print that data on user's printer ...??
    there is requirement that I can not use applet for this purpose.
    if any one done or have idea then let me know.
    thanks
    Shailesh Koradiya

    Hi
    Its simple, first of all break ur data in terms of pages. Write the logic in one JSP.
    suppose i have jsp PrintReport.jsp , for page 1 url will PrintReport.jsp?page=0 ... so on
    get the page parameter in JSP
    String page="";
    if(request.getParameter("page")!=null)
    page=request.getParameter("page");
    get the rowcount from the Result and assume records per page is 100
    if u have 1000 rows then 10 pages u have to serve
    StartRowNumber=page*recordsPerPage
    EndRowNumber=StartRowNumber+recordsPerPage
    Execute a SQL query , select * from table where rownum between
    StartRowNumber and EndRowNumber
    Provide google like pageNumbers in ur HTML page
    ie 1 2 3 4 5 6 ..10
    Regarding printing , Create HTML button called 'print' and add Javascript ' window.print()' on clicking it.
    Hope it would solve ur problem
    Cheers
    Rajendra Bandi

  • How to print from HTMLDB Report

    Hello
    How to print a report developped in HTMLDB report page ?

    Hello Patrick
    Thank you for the suggestion.
    Is there any idea to tailore the MSExcel pattern so
    that it does not permit final user to change the
    report content.Have you looked into using FOP to create PDFs?
    Here are a couple URLs:
    tech note
    http://www.oracle.com/technology/pub/notes/technote_htmldb_fop.html
    installation thread
    FOP installation
    Earl

  • How to print a HTML file in browser look using DocPrintJob

    Hello guys,
    Does anyone know how to print HTML output/file into browser look?
    I'm using DocPrintJob and the DocFlavor set to DocFlavor.INPUT_STREAM.AUTOSENSE.
    posted below is my code :
    public class BasicPrint {
        public static void main(String[] args) {
            try {
                // Open the image file
                String testData = "C:/new_page_1.html";
                InputStream is = new BufferedInputStream(new FileInputStream(testData));
                DocFlavor flavor =  DocFlavor.INPUT_STREAM.AUTOSENSE;
                // Find the default service
                PrintService service = PrintServiceLookup.lookupDefaultPrintService();
                System.out.println(service);
                // Create the print job
                DocPrintJob job = service.createPrintJob();
                Doc doc= new SimpleDoc(is, flavor, null);
                // Monitor print job events; for the implementation of PrintJobWatcher,
                // see e702 Determining When a Print Job Has Finished
                PrintJobWatcher pjDone = new PrintJobWatcher(job);
                // Print it
                job.print(doc, null);
                // Wait for the print job to be done
                pjDone.waitForDone();
                // It is now safe to close the input stream
                is.close();
            } catch (PrintException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
        static class PrintJobWatcher {
            // true iff it is safe to close the print job's input stream
            boolean done = false;
            PrintJobWatcher(DocPrintJob job) {
                // Add a listener to the print job
                job.addPrintJobListener(new PrintJobAdapter() {
                    public void printJobCanceled(PrintJobEvent pje) {
                        allDone();
                    public void printJobCompleted(PrintJobEvent pje) {
                        allDone();
                    public void printJobFailed(PrintJobEvent pje) {
                        allDone();
                    public void printJobNoMoreEvents(PrintJobEvent pje) {
                        allDone();
                    void allDone() {
                        synchronized (PrintJobWatcher.this) {
                            done = true;
                            PrintJobWatcher.this.notify();
            public synchronized void waitForDone() {
                try {
                    while (!done) {
                        wait();
                } catch (InterruptedException e) {
    }the printed ouput for this code will be look like this
    <html>
    <body>
    <div style="page-break-after:'always';
                background-color:#EEEEEE;
                width:400;
                height:70">
         testPrint</div>
    ABCDEFGHIJK<p>
     </p>
    </body>
    </html>however, the output that i want is the HTML in browser look not HTML code itself.
    i've tried to change the DocFlavor into any TEXT_HTML type but it gives error:
    sun.print.PrintJobFlavorException: invalid flavor if you guys has any idea or solution, can you share with me... already search in Google but still not found any solution
    Thanks in advanced.

    hi,
    do the following
    URL url = null;
    try
         url = new URL("http://www.xyz.com");
    catch (MalformedURLException e)
          System.out.println("URL not correct " + e.toString());
    if (url != null)
           getAppletContext().showDocument(url,"_blank"); //shows the page in a new unnamed top level browser instance.
    }hope that helpz
    cheerz
    ynkrish

  • Is there a way to print a Html-Report direktly in LabView?

    I created a Html-Report wich includes a jpg-Picture.
    Actually there is no way, in the Report Generation, to Print a Html file. I Would be
    glad if you have a solution (sub-vi?) to Print a Html file directly in Labview.
    Thanks
    PH!L

    You can drive IE with Lv through ActiveX: When you have creating an IE
    ActiveX reference with Lv, you will be able to open your file and then print
    them programmatically...
    "PH!L" a écrit dans le message news:
    [email protected]..
    > I created a Html-Report wich includes a jpg-Picture.
    > Actually there is no way, in the Report Generation, to Print a Html
    > file. I Would be
    > glad if you have a solution (sub-vi?) to Print a Html file directly in
    > Labview.
    > Thanks
    > PH!L

  • How to display a html report on jsp page---urgent

    i want to display a html report wen a tab is clicked.can any tell me how to do tat.

    Didn't quite get your requirement. What do you mean by an HTML report?

  • How to Print a interactive report without  action button and search bar

    Hello every one....
    I am working on printing an interactive report. If there are 20 columns in that report i need to select some columns for printing. For this purpose i used actions button which is in the search bar of the interactive report. But i do not want to get that Actions button and search bar to get printed in the printing page. Can any one give a solution to sort out my problem
    Thanks
    Manoj.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and ensure you have updated with your profile with a real handle instead of "886412".
    You'll get a faster, more effective response to your questions by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    I am working on printing an interactive report. If there are 20 columns in that report i need to select some columns for printing. For this purpose i used actions button which is in the search bar of the interactive report. But i do not want to get that Actions button and search bar to get printed in the printing page. Can any one give a solution to sort out my problemSee +{message:id=2475831}+
    Always search the forum thoroughly before posting a question: 98% of questions (like this one) have been answered before.

  • How to print my SQL Report

    Hi all,
    I want to print the SQL Report returned from a simple query returning 5 columns, and n number of rows. I don't want to use Oracle BI Publisher as its needs licence to work with. Can anyone let me know which software i can use with my application express. Moreover, do let me know the steps to integrate it in Application Express and finally to an SQL Report. Thanks a lot.
    I am using Oracle Application Express 3.2 + 10G XE
    With Regards,
    Krishna Vashishtha

    Hi Krishna,
    "Report printing is currently not available, there is no print server configured."
    For the above error, run the APEX Administration application and have a look at:
    --Manage Service
    ----Instance Settings
    ------Report Printing
    This might get you started with the built in functionality (I am not sure about this but have a look). You will also probably need to set up this area for FOP and JASPER.
    Sorry, I do not know which is better regarding FOP or JASPER. I have no personal experience with either of them. Perhaps you could try the "Ask Tom" web site. It might have a few hints.
    Can anyone else jump into this one with a pointer to a tutorial or two?
    Cheers,
    Patrick

  • How to print an HTML from an Applet ?

    I have a html file which has some images (<img></img> tag ) and some static contents.This html is generated by a Servlet.Currenlty i am doing a browser print. I do not want the print dialog box to appear.
    Is it possible to print this using an applet ? Using java print ?
    I am able to print a image from an applet using java print.
    But i am not able to print a html with images and text.
    Is there any way to convert such html into a image(jpeg,bmp) using java api ?

    I tried the Java printing API in 1.4.2 but found it hopeless in terms of printing anything without using AWT.
    Also since the print service was going to be on Windows machine I used jawin (http://sf.net/projects/jawinproject/) to query the registry for the command to print a particular extension and then exec that command.

  • ARIA Employee Directory -How to Print Multiple Direct Report On a page

    This question goes out to the experts. If we have person that has 10,15 or a large number of direct reports how can we print them on to a page so that they all fit. I am okay if they fall to another line just need to get them all on one page rather than multiple because they fall outside the print parameters?
    All help in this area would be greatly apprecaited
    Steve

    Maybe. Keep in mind HTML was never made for print. It's quite possibly the worst medium you could choose for print. You won't be able to establish page breaks or even draw consistent boxes. In short, I estimate the probability of success in creating an org chart with an HTML template to be somewhere around 1%. I just don't want to see you spend an absurd number of hours trying to build something that's really not possible.
    With that said, here are a few options to consider:
    - Microsoft Word and Visio both have Org Chart functionality, though I'm not sure if you can populate it with data from a database. This would be an offline solution wherein one of the developers would, on a periodic basis, generate a new version of the org chart, export it to PDF, then post it as a static file.
    - Oracle BI Publisher supports Word shapes for templates, including Org Charts per this documentation:
    http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#T481174
    though I think it might take effort to get the template to work. At least the output medium (PDF or RTF) is made for print.
    - GraphViz (http://www.graphviz.org) is the most promising online solution I can think of. It's a command-line tool, so you would need to
    -- generate the data in a file and output that to the file system of the database server (UTL_FILE)
    -- call the command-line utility via a dbms_scheduler job, since you need call an OS utility from inside the database
    -- provide a link to the output of graphviz.
    Take a look at this image, then click on it to see the code that generated it, since that's essentially the format you'll need to output:
    http://www.graphviz.org/Gallery/directed/unix.html
    There's my 2 cents. If someone is asking you to do this all in HTML, please send them a link to this post.
    Tyler

  • How to print formated data/report on client's printer (Web Application)

    Hi All
    I want to print some formatted data/report ( it might be 1000 pages) on user's printer.
    Application is web based
    Technology used are Java - jsp - servlets
    i want functionality like...
    when user click on print button/link, data is fetched from server and all pages (it is formated data so i want alignment on page while printing) should be printed one after another.
    Also printer selection dialog should displayed one time when user click on print button/link.
    Questions:
    1. How i will transfer all data to client (web browser) from the server ??
    2. And how i can print that data on user's printer ??
    There is requirement (or limitation) that I can not use applet for this purpose.
    And also it is not fix that we must use java tech., we can use any othere tech. but condition is that it must support multiple platform (in short platform indipendant)
    There is solution like ...
    I can use window.print() function of DOM/JavaScript,
    but it prints only one page which is displayed on browser.
    I don't want to display any page. and want to print all pages.
    if any one done or have idea then let me know.
    Thanks in Adv.
    Shailesh Koradiya

    thanks linxpda for reply,
    we can use ActiveX component for windows platform for printing purpose, same way we can use platform specific component for printing... (for linux, unix, sun solaris etc...)
    if it is possible then let me inform.
    Thanks,
    Shailesh Koradiya

  • How to print a crystal report in Tally MT691 line printer?

    I have recently developed a crystal report with version 8.5 in windows-based operation system (windows xp). My client today told me that the report has to be able to print to a network printer - line printer (Tally MT691); otherwise, the crystal report I developed becomes useless. I have no experiences with line printer. Could you please give me some instructions on how to make it happen?
    Any help is greatly appreciated. Thanks again.
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on May 7, 2009 11:05 AM

    Hi
    Unfortunatelly you need to worry about the printer, please don't consider the last replies.
    As far I can see this model is a dot matrix printer, only the following models are supported for SAP B1:
    For 2005A those are the supported models:
    - Citizen PROdot 300    
    - Epson FX-880          
    - OKI MICROLINE 320 Elite
    - Epson FX-890          
    For the 2007
    - Citizen PROdot 300    
    - Epson FX-880          
    - OKI MICROLINE 320 Elite
    Please note that some workaround can be found to use different printer but only the mentioned devices are supported. Those workarounds may work in one patch but may stop to work after patch or version upgrade.
    Also a multipurpose (combine fax, printer, scanner) devices are also note supported (SAP Note 925841).
    Paulo Calado
    SAP Business One Forums Team

  • How to print new main report page based on number of records in subreport?

    Hi,
    I've a main report which prints on a pre-printed stationary with 2 subreports in the detail section.  The subreport prints multiple records.  If there are more than 6 records in the subreports, a new page should be printed with all the contents of the main report and the subreports should continue with the remaining records.  How can I do this?  I've tried incrementing a shared variable counter in the subreport and accessed that variable in the detail section of the main report to check the counter and reset the counter to 0 if it exceeds 6.  But this does not work.  All the lines till it can hit page footer are printing on first page and the second page prints only the remaining subreport lines without the other details of the main report page. 
    The main report page uses a view which returns only 1 record. The subreport returns multiple records. 
    I would certainly appreciate if any one can provide a solution for this problem. 
    Thanks,
    Ram

    hi Ram,
    sorry, i misunderstood exactly what you wanted.
    let me get this straight...
    1) if there's more than 6 records in the subreport then show only the first 6 records
    2) then (if there's more than 6 records) do a new page after the subreport
    3) then (if there's more than 6 records) show the subreport's remaining records and the rest of the report
    let know if i've got it straight.
    if that is correct, you will have received another sample report that does this. in total 3 subreports are used...one is a dummy report that adds up the number of records which is used later. there's more info on the report's design mode.
    cheers,
    jamie

Maybe you are looking for

  • Creating variables in OLAP DML - 11g

    Hi Experts, My understanding is that the OLAP metadata is exposed to GUI via formulas only. if I create a variable in OLAP DML worksheet, is it possible to expose it to cube view, and awm by formulas/programs etc? Kind Regards

  • JDBC Sender adapter - can VIEW be used in Query statement

    Hi, In JDBC Sender adapter, can we use a VIEW sql query in the "Query SQL Statement" placeholder? For eg: CREATE VIEW <view name> as SELECT * from <table name> WHERE <condition> instead of the usual: SELECT * from <table name> WHERE <condition> Thank

  • The specified website does not appear to be created in Adobe Muse CC 2014 or later

    I re-saved a website and FTP'd all files to a site hosted on GoDaddy. When I try to use in-browser editing on inbrowserediting.adobe.com, I get the message in the title. What am I missing?

  • Using Spaces (in the System Preferences)

    I have enabled the Spaces from the System Preferences to keep my programs more organized. I am a graphic designer and I use almost every program of the Adobe Suite on a regular basis. I had put the different programs in four different spaces because

  • Radio buttons determine which company logo is displayed

    In ES9 I created a form using the Action Builder feature where the first line is two radio buttons for the user to select which of our two companies they work for. Depending on their selection, the corresponding company logo is changed from invisible