Forum Stats

  • 3,733,825 Users
  • 2,246,827 Discussions
  • 7,856,887 Comments

Discussions

Is there a way to get all printers out of the local pc and not just the default one?

Iker Garcia Martin
Iker Garcia Martin Member Posts: 19 Red Ribbon

Hi,

We are migrating an application from oracle forms 6i to 12c (12.2.1.4). On a screen we have a button with the WIN_API_DIALOG.SELECT_PRINTER statement where the user can choose the printers that he has configured on his PC. Is there a way to do the same in Forms 12c?

We have to installed:

Oracle Weblogic 12.2.1.4

Oracle Forms 12.2.1.4

Oracle Reports 12.2.1.3


 I execute

CLIENT_WIN_API_ENVIRONMENT.Read_Registry

('HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows', 'Device', true);


This method works for default printer, Is there a way to get all printers out of the local pc and not just the default one?


Thanks,

Iker

Answers

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,627 Employee

    What are you planning to do with this list once you have it? Since printing a form already lists all the printers and you can't easily set a specific printer programmatically, understanding your end goal would be helpful.

    The answer may help come up with an appropriate way to achieve your goal or a completely alternate way of doing it.

  • Iker Garcia Martin
    Iker Garcia Martin Member Posts: 19 Red Ribbon
    We want to have in a button of the form that when the user clicks it, the printers that he has installed on his computer will appear
    


  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,627 Employee

    I think you missed my point. I realize you want to share the list with the user, but once they have the list what will they do with it? Forms offers no way to print anything except copy of the displayed form and that functionality already shows a list of printers. What do you plan to print and how will you accomplish this?

    Looking at the screen shot, although I can’t read it, I might guess and say this was for calling Oracle Reports. If so, realize that Reports will not be sent to the user printer. It will print relative to the server.

    Understand that in newer versions of the software all PLSQL code is executed on the server. So calls to printing and similar happen on the server and not the client machine as they did in old versions.

  • Iker Garcia Martin
    Iker Garcia Martin Member Posts: 19 Red Ribbon
    From the Oracle Forms, we call Oracle Reports
    


  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,627 Employee

    So as I mentioned, unless you are using network printers, having the list of printers won't help much. Reports output targeted for a printer will look for the printers on the server. If you want to print relative to the user machine, some application changes will be needed.

  • Iker Garcia Martin
    Iker Garcia Martin Member Posts: 19 Red Ribbon
    That is what we need, print by the user's machine that you select. From what I understand, this is possible, right?
    


  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,627 Employee

    As I mentioned, all the work happens on the server. Think of the server (mid-tier) as the client to the DB rather than the actual end-user.

    So, as I further mentioned, unless the users' printers are network enabled, they cannot easily print locally. The server will need to access the user's local printer over the net.

    One possible option would be to WebUtil enable your form. Then after the report output has been generated, download it to the user tier using WebUtil and open it. If desired, you could also use WebUtil to delete the downloaded file. Or, you can always just display the report and let the user choose to print or save after first displaying it. If you use the getJobId value from Reports you will be able to use Forms WEB.SHOW_DOCUMENT built-in to display the output as I mentioned.

    Refer to the Forms/Reports Integration Guide for more information:

    https://www.oracle.com/application-development/technologies/forms/forms.html#panel2

    Note that Oracle previously delivered a demo (many years ago) that illustrated how you might overcome this problem. It is no longer recommended that this demo be used any longer. Also understand it was never supported, as it was merely a "demo" to use as an idea of what might be possible. Again, I do not recommend using it if you happen to find it or someone mentions it.

  • ben_g
    ben_g Member Posts: 24 Red Ribbon

    Hi Iker

    The Forms applications I look after do this as Michael suggested, using WebUtil.

    After any report has been run a single button click in Forms will spool it to the user's default printer.

    The functionality is provided by a custom utility that's delivered to our users in a package they get along with Java and all the shortcuts for their Forms apps.

    The utility is a C# console application which accepts command line parameters. We invoke that using WebUtil and the parameters are the interface between the Java client running Forms and the utility running on Windows.

    As your requirement is to allow users to choose from their list of configured printers, you'll need to do an extra step first such as executing

    wmic printer list brief

    Piping its output to a text file and reading that text file to get the list of printers to display in your Form.

    All of that you can do using WebUtil but you need to build it.


    Ben

Sign In or Register to comment.