473,513 Members | 2,493 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use Firefox's Javascript w/o the browser?

2 New Member
Hi all, I'm trying to use Firefox to as an html renderer for reports. All I really want it to do is display a print dialog so I can select the printer I want to print to, and then print the HTML. I can make IE do this with perl and OLE, but IE's print engine kinda sucks (and blows, at the same time). Anyone know if this is even vaguely feasible? I though maybe I could get away with just making the 'window' invisible, small or at least closing the darn thing from a script after I'm done printing. I haven't found a way to make it not show, or be so small as to be unnoticable, and closing the window doesn't work reliable with tabs :(. It'd make a great report printer for my scripting needs if I could just get it to integrate nicely.

Oh, here's the perl code to make IE do what I want it to do, in case anyone can use it. For me, IE's too tempermental...

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings 'all';
  4.  
  5. use Win32::OLE;
  6. use Win32::OLE::Const 'Microsoft Internet Controls';
  7. use Win32::OLE::Variant;
  8.  
  9. # From Vc7/PlatformSDK/Include/MsHtmHst.h :
  10. use constant PRINT_DONTBOTHERUSER    => 0x01;
  11. use constant PRINT_WAITFORCOMPLETION => 0x02;
  12.  
  13. my $file = "C:\\FixReportBase\\realtest\\pg_0001.htm";
  14. my $do_not_prompt = 0;
  15.  
  16. my $nCmdID      = OLECMDID_PRINT;
  17. my $nCmdExecOpt = OLECMDEXECOPT_PROMPTUSER;
  18. my $pvaIn       = PRINT_WAITFORCOMPLETION;
  19. my $pvaOut      = 0;
  20.  
  21. if ($do_not_prompt) {
  22.   $nCmdExecOpt  = OLECMDEXECOPT_DONTPROMPTUSER;
  23.   $pvaIn       |= PRINT_DONTBOTHERUSER;
  24. }
  25.  
  26. my $IE = Win32::OLE->new('InternetExplorer.Application') or die;
  27. #$IE->{'Visible'} = 1;
  28. $IE->Navigate( $file );
  29. sleep 1 while $IE->{Busy};
  30.  
  31. $IE->ExecWB($nCmdID, $nCmdExecOpt, Variant(VT_I2,$pvaIn), $pvaOut);
  32.  
  33. $IE->Quit();
Jun 19 '07 #1
3 1494
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

I'm sorry I don't think this is possible using standard Javascript. You can only do this kind of stuff in IE using JScript/ActiveX. Firefox is too safe for that!
Jun 20 '07 #2
rsilvergun
2 New Member
Figures, I guess I should be glad though since I browse with Firefox :). I'm looking into other ways of doing what I want to do. In the meantime I've wimped out. I printed my HTML to postscript using a postscript printer redirected to a file printer, and I'm using that as a makeshift template for my reports. I still like the idea of generating HTML reports I can print from my script using Firefox. There's XPCOM, which looks like Gecko's take on COM, but it may be beyond my current abilities and time constraints (I just started a new job, and don't have as much time to play with this sort of stuff as I used to). If I can figure out a way to do it, I'll post it to sourceforge.net, wish me luck :).
Jun 22 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Good luck. I don't have much experience in this kind of stuff. Hopefully, someone can help you or you manage to figure something out yourself.
Jun 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
9281
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
23
16104
by: Loony | last post by:
I have got a code like this in HTML section in ASP file which includes javascript file! The script works under MS IE but doesn't with Firefox! Can anybody tell me what is wrong? <HTML>...
14
12627
by: Karin Jensen | last post by:
Hi - I am trying to use Javascript to put material inside a table (i.e. alongside the previous material) if the user's screensize is big enough and outide the table (beneath table) if it isn't. ...
6
14432
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the...
4
2312
by: lmarceglia | last post by:
Hi, I have this website that doesn't work in Firefox 1.5: www.pianetaluca.com The HTML source is: <TITLE>PianetaLuca</TITLE> </HEAD>
11
3407
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
12
1754
by: amit | last post by:
Hello group, I'm kinda skeptical about a code is being used in my js program. All it does is checking what browser is being run and finds out if FLASH is installed or not. This code works...
8
1913
by: Matt Kruse | last post by:
http://news.zdnet.com/2100-1009_22-6121608.html Hackers claim zero-day flaw in Firefox 09 / 30 / 06 | By Joris Evers SAN DIEGO--The open-source Firefox Web browser is critically flawed in...
1
4183
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
29
3874
Frinavale
by: Frinavale | last post by:
I have 2 FireFox (version 2) browser windows opened. One is the child of the other. When the user is finished with the child window, a method in the parent window is called to refresh a...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.