Two problems when printing behind WAS

Author: knut.dybendahl@gmail.com (Knut)

Hi all, Problem 1; I have a form / report component (FRM1) called from a USP using activate. In FRM1 I do a print "LASER1", "A" and Uniface gives me a -400 error. LASER1 is defined as a logical printer (in USYS.INI) - and maps to a printer model LASER1 which is set up to use P_MSWINX with /nodialog and /queue=LASER1. I've changed the login of userver to use my own credentials so I'm sure I have the appropriate access rights to get to the spooler - but simply no joy...  Just to be clear - I need to produce the file on the server - and return the result....  in the example above I print to a network printer / local port defined as a file - neither works.   As a side issue, as I need to produce a pdf file and send that pdf file back to the browser, I've had a look at PdfCreator.  Does anyone have any alternatives?   Problem 2; The output contains an image loaded from a disc file.  When viewing the image on screen (scaling = 100) - the image appears correct.  When running in the report it's stretched beyond the size of the image field - even though it's the same component.  Any ideas anyone?

7 Comments

  1. KnutD said How does the .ini registry entries get there in the first place?  Manually?

    That's correct, you need to manually add/create the .ini registry entries. Hope this helps. Regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  2. Hi Daniel, At the moment I've got one logical printer defined - and I can see it in regedit under hkey_current_user\software\compuware\uniface\usys9\prt_laser and in hkey_users\s-1-5......\software\cimpuware\uniface\usys9\prt_laser1 However, I cannot see any entries \ references to any .ini file - anywhere. When I'm using procmon.exe - these are the locations userver looks in; HKU\.DEFAULT\Software\Compuware\Uniface\USYS9\usys:userver.aps\PRT_LASER1 HKU\.DEFAULT\Software\Compuware\Uniface\USYS9\PRT_LASER1 HKU\.DEFAULT\Software\Compuware\Uniface\USYS8\PRT_LASER1 HKU\.DEFAULT\Software\Compuware\Uniface\C:\Program Files\Compuware\Uniface 9.6.01\uniface\adm\USYS.ini\PRT_LASER1 HKLM\Software\Compuware\Uniface\C:\Program Files\Compuware\Uniface 9.6.01\uniface\adm\USYS.ini\PRT_LASER1 HKLM\Software\Compuware\Uniface\C:\Program Files\Compuware\Uniface 9.6.01\uniface\adm\default_ini\PRT_LASER1 HKU\.DEFAULT\Software\Compuware\Uniface\USYS9\usys:userver.aps\PRT_LASER1 HKU\.DEFAULT\Software\Compuware\Uniface\USYS9\PRT_LASER1 HKU\.DEFAULT\Software\Compuware\Uniface\USYS8\PRT_LASER1 HKU\.DEFAULT\Software\Compuware\Uniface\C:\Program Files\Compuware\Uniface 9.6.01\uniface\adm\USYS.ini\PRT_LASER1 HKLM\Software\Compuware\Uniface\C:\Program Files\Compuware\Uniface 9.6.01\uniface\adm\USYS.ini\PRT_LASER1 HKLM\Software\Compuware\Uniface\C:\Program Files\Compuware\Uniface 9.6.01\uniface\adm\default_ini\PRT_LASER1 How does the .ini registry entries get there in the first place?  Manually? Cheers, Knut


    Author: Knut (knut.dybendahl@gmail.com)
  3. KnutD said It raises the question though - why use the registry in the 1st instance when the ASN / INI file combination has worked well for a number of years??

    Hi Knut, The Logical Printer definitions were always stored in the registry - only the mapping between physical and logical printer is defined in the INI file. So the "change in behavior" is a result of changes in Windows - before Windows Server 2008 the user registry hive always was present (in memory) and since Windows Server 2008 the user registry hive is unloaded when the user is not logged on locally to the system. Hope this helps. Regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  4. Hi Daniel, Thank you - I suspected it might had to do with the registry - although I haven't been able to dig into it too much. If the user is logged on (this is a W2008R2 server) - sometimes it (kinda) works - mostly not.  I'll do some more digging now that you've alerted me to some of these 'pitfalls'. It raises the question though - why use the registry in the 1st instance when the ASN / INI file combination has worked well for a number of years?? Regards, Knut


    Author: Knut (knut.dybendahl@gmail.com)
  5. Hi Knut, This is concerning problem 1: It might be a good idea to check with (e.g.) the Windows Sysinternals Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645) in which registry key the UServer is searching the logical printer definitions. There are some pitfalls you have to keep in mind when trying to print from a UServer:

    1. You need to use the UServer command line switch /su to make sure that the server is using the environment of the user - otherwise it will use the environment of SYSTEM
    2. On Windows Vista and Server 2008 (and newer) the user registry hive is unloaded when the user is not logged on to the console of the system; if the user registry hive is not loaded then the environment of the default user will be used (HKU.DEFAULT) - HKU=HKEY_USERS
    3. Uniface has an (undocumented) fall back mechanism for the logical printer definitions: When Uniface (32-bit) is installed in (e.g.) "C:\Program Files (x86)\Compuware\Uniface 9.6.02" (64-bit Windows) and a logical printer called LOGICAL1 is defined then the logical printer definitions are also searched here (in case /adm=C:\Program Files (x86)\Compuware\Uniface 9.6.02\uniface\adm and /ini=usys.ini or not specified):    HKLM\Software\Wow6432Node\Compuware\Uniface\C:\Program Files (x86)\Compuware\Uniface 9.6.02\uniface\adm\USYS.ini\PRT_LOGICAL1 In case a 32 bit Windows system is used (or a 64 bit Uniface installation on a 64 bit Windows) then the key should look like this:     HKLM\Software\Compuware\Uniface\C:\Program Files\Compuware\Uniface 9.6.02\uniface\adm\USYS.ini\PRT_LOGICAL1 Please keep in mind that you need to give the UServer user the proper permissions so that it can access the mentioned HKLM (HKEY_LOCAL_MACHINE) registry key.

    Note: we are currently investigating why the UServer does not load the user registry hive correctly when the /su command line switch is used. And I've asked that the fallback registry key for the logical printer definitions is added to the documentation. I hope this makes sense. Kind regards, Daniel  


    Author: diseli (daniel.iseli@uniface.com)
  6. Hi Theo, Thank you for that - all checks out ok...  Once I figure it out I'll post back. Knut


    Author: Knut (knut.dybendahl@gmail.com)
  7. No immediate solution in mind. Maybe this diagnostic tool that I made a couple of years ago helps: http://theunifaceuniverse.blogspot.nl/2011/12/uniface-printing-on-windows.html  


    Author: Theo Neeskens (tneeskens@itblockz.nl)