Change System Printer

EmerikEmerik Member Posts: 50
edited 2009-08-12 in Navision Attain
Hi all,
I've been searching the forum for a solution to my problem.
I have a report, I would like to print with a PDF-printer.
I do not want Navision to prompt me for a choice of printer. I want to change the System Printer to the PDF-printer, print the report without request forms or other user intervention and restore the system printer settings afterwards. Is there any way to do this?

BTW, any recommandations for a free PDF-printer, which is flexible and highly configurable from Navision code?

Thanks in advance.

/Emerik

Comments

  • kapamaroukapamarou Member Posts: 1,152
    You can go to the Printer Selections form and setup reports and printers to use per user (all blank for all users...).
  • EmerikEmerik Member Posts: 50
    Is it possible with C/AL code to decide which printer to use? Or to change the System Printer? If there is, I'm also looking for that way to do it.
  • kapamaroukapamarou Member Posts: 1,152
    I think that when you run a report Function FindPrinter(ReportID) in Codeunit 1 is executed. So the only thing you would have to do would be (also in code) to play around with the UseReqForm,UseSystemPrinter and the other properties in the report...
  • jwikmanjwikman Member Posts: 25
    Emerik wrote:
    Hi all,
    I've been searching the forum for a solution to my problem.
    I have a report, I would like to print with a PDF-printer.
    I do not want Navision to prompt me for a choice of printer. I want to change the System Printer to the PDF-printer, print the report without request forms or other user intervention and restore the system printer settings afterwards. Is there any way to do this?

    BTW, any recommandations for a free PDF-printer, which is flexible and highly configurable from Navision code?

    Thanks in advance.

    /Emerik

    You can change the users default printer by running this with 'Windows Script Host Object Model'.WshShell:
    rundll32 printui.dll,PrintUIEntry /y /n "Your Printer Name"
    
    After print out you have to change it back.

    Hope this will help!
  • EmerikEmerik Member Posts: 50
    You can change the users default printer by running this with 'Windows Script Host Object Model'.WshShell:
    rundll32 printui.dll,PrintUIEntry /y /n "Your Printer Name"
    

    After print out you have to change it back.

    Cool! :)

    Is there some way of telling me the name of the default printer, before I change it? If I have to change back the printer, I would need to know what it was before, I changed it. It can be various different printers depending on the user.
  • jwikmanjwikman Member Posts: 25
    Emerik wrote:
    Cool! :)

    Is there some way of telling me the name of the default printer, before I change it? If I have to change back the printer, I would need to know what it was before, I changed it. It can be various different printers depending on the user.

    Sorry, but I've got no good solution for that. I solved it by adding a field to table User Setup, "Default printer name".

    But please share if you find a nice way to find out which printer is the default printer for the logged in user. :)
  • garakgarak Member Posts: 3,263
    Follow the LINK

    viewtopic.php?f=5&t=25833

    Regards
    Do you make it right, it works too!
  • jwikmanjwikman Member Posts: 25
    Thanks garak!

    I guess I didn't manage to use the search function earlier... :oops:
  • garakgarak Member Posts: 3,263
    No prob, you're welcome
    Do you make it right, it works too!
Sign In or Register to comment.