` Printed Icetips Article

Icetips Article



Par2: Reports under IE4 and IISAPI broker: setting the printer
1999-02-25 -- Tony Goldstein
 
>c.  "The Bug":  For some reason, running the CWIC application on an NT
>Application Broker seems to result in a WMF that is sized to the NT
>Server's Screen Resolution.  This is a BIG PROBLEM, unless you happen
>to have a server running at 1600 x 1200...  If you look at the Sample
>program I mentioned, you'll find that the Report image is sized at
>640x480, because that's the resolution that the web server is set at
>right now.  Note also that the sizing is not a SCALING of the image,
>but a TRUNCATION of the image.  That means that we're only getting the
>Top Left corner of the report right now.
>
>I've been told that this sizing problem is related to the current
>PRINTER settings:  Supposedly, when no default printer is set, the
>screen resolution is used.  However, CWIC seems to be resisting all my
>attempts to set the Printer Device / Port through the
>PRINTERS{PropPrint:} settings.  If anybody can help me work around
>this problem, I'd be extremely grateful.  
>

"The Bug" was indeed a direct result of the Printer Settings.  The
following writeup addresses the problem.  Note that the Registry Keys
listed in this message may have been wordwrapped; the key names should
only be on one line.

PROBLEMS:

Under CWIC, running under the ISAPI Broker on Windows NT, the
following related problems may be observed:
   1)  Inability to set the PRINTER device / No available Printers.
   2)  WMF files produced by Clarion Reports are sized to the wrong
dimensions:  The take the height and width of the ISAPI Server's
Screen Resolution.

Problem #2 is believed to be a direct result of Problem #1.

These problems do not manifest under Windows 95, or on NT when the EXE
Broker is used.

CAUSE:

Applications launched by the ISAPI broker are run from the NT System
account.  This account is not a normal login, and indeed, you can't
log in as SYSTEM.  Therefore, the System account has NO printers set
up.  This explains Problem #1.  Problem #2 is a result of the default
Clarion behavior when no printers are present.

SOLUTION:

One way to establish printers for your System account is to do a
little registry editing on the NT server.
   
Here's what you want to do:  You want to take the printer settings
from a valid login, and apply them to the System (.DEFAULT) login.

What to look for:  Three keys under the HKEY_USERS\S-XXX branch (where
XXX is your SID, a long set of numbers separated by dashes)

1)  [HKEY_USERS\S-XXX\Software\Microsoft\Windows
NT\CurrentVersion\Devices]
2)  [HKEY_USERS\S-XXX\Software\Microsoft\Windows
NT\CurrentVersion\PrinterPorts]
3)  [HKEY_USERS\S-XXX\Software\Microsoft\Windows
NT\CurrentVersion\Windows]
    
Find these for an SID that contains some valid Printers.  EXPORT these
three Keys.  Edit the Export files, and replace the SID with .DEFAULT.
IMPORT the modified Keys.  And you're done!

   You may need to stop and restart the IIS service.

   Examples:

   These were my original keys:

   1) [HKEY_USERS\S-(Some long string of
numbers)\Software\Microsoft\Windows NT\CurrentVersion\Devices]
      "RightFax Fax Printer"="winspool,Ne00:"
      "\\\\MYSERVER\\HP LaserJet 4 Plus"="winspool,Ne01:"
      "\\\\MYSERVER\\HP LaserJet III"="winspool,Ne02:"
      "\\\\MYSERVER\\hpfax"="winspool,Ne03:"

   2) [HKEY_USERS\S-(Some long string of
numbers)\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts]
      "RightFax Fax Printer"="winspool,Ne00:,15,45"
      "\\\\MYSERVER\\HP LaserJet 4 Plus"="winspool,Ne01:,15,45"
      "\\\\MYSERVER\\HP LaserJet III"="winspool,Ne02:,15,45"
      "\\\\MYSERVER\\hpfax"="winspool,Ne03:,15,45"

   3) [HKEY_USERS\S-(Some long string of
numbers)\Software\Microsoft\Windows NT\CurrentVersion\Windows]
      "load"=""
      "run"=""
      "NullPort"="None"
      "Programs"="com exe bat pif cmd"
      "Documents"=""
      "DosPrint"="no"
      "NetMessage"="no"
      "DebugOptions"="2048"
      "Device"="\\\\MYSERVER\\HP LaserJet 4 Plus,winspool,Ne01:"

   And here is what I added:

    REGEDIT4

    [HKEY_USERS\.DEFAULT\Software\Microsoft\Windows
NT\CurrentVersion\Devices]
    "\\\\MYSERVER\\HP LaserJet 4 Plus"="winspool,Ne01:"

    [HKEY_USERS\.DEFAULT\Software\Microsoft\Windows
NT\CurrentVersion\PrinterPorts]
    "\\\\MYSERVER\\HP LaserJet 4 Plus"="winspool,Ne01:,15,45"

    [HKEY_USERS\.DEFAULT\Software\Microsoft\Windows
NT\CurrentVersion\Windows]
    "load"=""
    "run"=""
    "NullPort"="None"
    "Programs"="com exe bat pif cmd"
    "Documents"=""
    "DosPrint"="no"
    "NetMessage"="no"
    "DebugOptions"="2048"
    "Device"="\\\\MYSERVER\\HP LaserJet 4 Plus,winspool,Ne01:"


Upon adding the new keys, I stopped and restarted the IIS service (For
good luck), and when I ran my next CWIC application Problems #1 and #2
were solved!

----

With The Bug out of the way, progress on an on-the-fly WMF to PNG
converter is going rather well.  As PNG files, report pages tend to
take up between 20 and 30 K.  Still having some trouble getting the
PNG's to display in Netscape, but they show up perfectly in IE4.  

The process uses ImgDLL, an excellent $25 image conversion tool.  No
OCX needed!

JPG's are also possible, for browsers that don't support PNG, but tend
towards 100 K or more.

Non-LZW GIF's can be done ranging from 50 to 100 K for simple reports;
but can run MUCH higher for complicated images.  Non-LZW GIF's fall
under the jurisdiction of the Unisys licensing rules.



Printed May 4, 2024, 2:24 am
This article has been viewed/printed 35110 times.