473,670 Members | 2,615 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 1500
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
9295
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 action="MaintNotification.php?ReqID=5" method="post" name="frm5"> <tr align="left" bgcolor="#dddddd" class="text" onClick="submit()"
23
16130
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> <HEAD><TITLE></TITLE> <SCRIPT LANGUAGE="JavaScript" SRC="../inc/JSfile.js"><SCRIPT> <SCRIPT> <!-- other javascript scripts working propely
14
12645
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. The following code (tag properties and other extraneous material removed) works in IE but not Firefox: <table> <tr><td> first set of material </td>
6
14448
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 postback code, but I have a workaround for that installed (and it looks like the code generated by ASP.NET when it renders the page does the same thing, namely, setting document<). However, the problem still exists under firefox. Has anyone come...
4
2321
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
3426
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 no buttons react to clicking. The website's helpdesk says it should work with Firefox, and could not offer any more advices. The JavaScript Console shows that there are numerous errors occuring. It looks like the web browser does not recognise...
12
1766
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 just fine withe IE but as far as Firefox I'm not sure. Using the firefox I can see flash pages easily but when this code says firefox is not installed in my firefox!!!
8
1922
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 the way it handles JavaScript, two hackers said Saturday afternoon. An attacker could commandeer a computer running the browser simply by crafting a Web page that contains some malicious JavaScript code, Mischa Spiegelmock and Andrew Wbeelsoi...
1
4193
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 aligned to the top, along with the slideshow and link buttons, you have to scroll down to see the text - how can I make IE6 display correctly? http://geekarama.co.uk/new_home.html here is the code for new_home.html and following that the CSS...
29
3898
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 section of the page. This is the JavaScript code that I'm using to refresh the content in the parent page: <script type="text/javascript"> function UpdateList() {
0
8471
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8592
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4213
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2802
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1795
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.