Page 1 of 1
Calling PdfUtil.PrintFile throws an exception
Posted: Wed May 02, 2012 3:19 pm
by atarothtoer
Hi, i'm developing a windows service that sends the print job to convert office documents to pdf, when i run the same code from a web app or a desktop app it works fine but in the service (wich runs under local system account) after calling PdfUtil.PrintFile(filePath, printerName) after a long wait it throws an exception saying there's no process associated with the object, i've follow the instructions given here:
http://www.biopdf.com/guide/examples/network_sharing/ , to allow the pdf printer to work without the use of impersonation; but with no results, someone can give any idea about whats happening? Thanks for your attention.
Re: Calling PdfUtil.PrintFile throws an exception
Posted: Mon May 07, 2012 5:32 pm
by atarothtoer
Hi, after some tests and debugging found that the problem relates to the Session0 isolation schema, the service runs in the session 0, from there it can't open archives for an user account (in my case the file that must be printed is under my documents) the service needs credentials to access the archive, i haven't tested putting the files in a user independent folder such inetpub. But with the credentials the service can send the print job and creates the pdf document, thank you and keep the good work.
Re: Calling PdfUtil.PrintFile throws an exception
Posted: Thu May 10, 2012 5:57 pm
by atarothtoer
Well, finally i've made the test printing an office document located inside a subfolder under "inetpub\wwwroot\", same history: the service needs credentials in order to been able to open the document (the exception is thrown when the service can't open the office file). Hope this helps anyone out there, once again congratulations for your good work with the API.
Re: Calling PdfUtil.PrintFile throws an exception
Posted: Sun May 13, 2012 12:59 pm
by sdmaha
Hey.. Congratulations! on your success.
I hope, you are now also able to print from an IIS web application as you had posted this issue in your other post.
Just wondering if you could share some more information, as I am still facing the same permissions issue when trying to print inside ASP.NET IIS web application or using a Windows Service. The same code is running fine from a normal Desktop application or when run directly from Visual Studio.
To give you an overview of what I am trying to do: I am downloading the original PDF from an external place into a particular folder and printing it in a particular pre-defined format in the same folder. The folders are created dynamically from within my application based on some path requirement logic.
I have tried giving all types of permissions (that I could think about) to this folder and also tried the disable impersonation and so to say tricks. But still the printer api is not able to print it from IIS web app or from a Windows Service, installed with LocalSystem or my own User account, which is an Administrator. The same code however works fine from Visual Studio.
Re: Calling PdfUtil.PrintFile throws an exception
Posted: Mon Jul 23, 2012 12:52 pm
by pbne04
Hello,
I just submitted a proposal on msdn to fix a similar problem I recently had - you might want to checke it out:
http://social.msdn.microsoft.com/Forums ... 8cde7eac15
Hope it helps,
Peter