Options

Print Report from Webservice (No PDF)

2»

Answers

  • Options
    jreynoldsjreynolds Member Posts: 175
    I am having problems with this technique of printing PDF files from NAV. I have one environment on my laptop with all 3 tiers (SQL, NAV Server, RTC) running on the same machine and this works just fine. In our corporate development environment it is not working. This environment has SQL running on one machine and a terminal server that users connect to which is also running the NAV Server. In this environment this technique fails. Process.Start() runs and exits immediately without error, but nothing prints.

    Actually, I have simplified things a bit by replacing the call to Foxit Reader with a call to a simple batch file that copies a file. On my laptop all works fine, but in the other environment the batch file fails to run. I have checked permissions for the domain account that is running the NAV server and all is in order.

    There is obviously something different in the two environments that is causing this difference, but I can’t figure out what that important difference is.

    Thanks in advance for any help.
  • Options
    deV.chdeV.ch Member Posts: 543
    Check the permissions of the user you are using for the webservice. This one needs the permissions! the user of the nav-server is not the one executing the method.
    Further for printing: the user executing needs access to the printer you are using. If you can't run a batch file with this method, you have 99% permission issues. where is your batch file located? Win7 / Win Server 2008 ? then you can only have permissions on the user folder.
  • Options
    deV.chdeV.ch Member Posts: 543
    Important Update: At the time i posted this solution, it was not in productional use, i tested it only on a demo environment. Now that i'am implementing this for a customer i have to admit, that this solutions is not fully working.
    In fact you need another component to print the pdfs if you wan't to use "Network Service" Account as the Account for the Webservice. Since Network Service doesn't have any printers, you need another Service that is running under an account that has printers available.

    What i did was a small .Net Service that uses the FolderWatcher Class to watch a folder for incoming pdf files. in the Filename i put the printers name and parsed it out to print to the correct printer. This is working perfectly fo rme. I hope it helps someone else too.
  • Options
    BuhlBuhl Member Posts: 1
    I have a similar challange (automated print of pdf files) and this solution seems as very elegant - however, could someone tell me which type of variable from deV.ch's script above this is??: PrintDoc := PrintDoc.PrintDocument();

    Best regards
    Hans
  • Options
    deV.chdeV.ch Member Posts: 543
    Hello Hans

    Its PrintDocument Class (DotNet) http://msdn.microsoft.com/en-us/library ... ument.aspx
Sign In or Register to comment.