Calling PdfUtil.PrintFile throws an exception

About the programming interface for the virtual PDF printer driver.

Moderator: jr

Calling PdfUtil.PrintFile throws an exception

Postby atarothtoer » Wed May 02, 2012 3:19 pm

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.
atarothtoer
 
Posts: 5
Joined: Wed Apr 04, 2012 3:33 pm

Re: Calling PdfUtil.PrintFile throws an exception

Postby atarothtoer » Mon May 07, 2012 5:32 pm

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.
atarothtoer
 
Posts: 5
Joined: Wed Apr 04, 2012 3:33 pm

Re: Calling PdfUtil.PrintFile throws an exception

Postby atarothtoer » Thu May 10, 2012 5:57 pm

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.
atarothtoer
 
Posts: 5
Joined: Wed Apr 04, 2012 3:33 pm

Re: Calling PdfUtil.PrintFile throws an exception

Postby sdmaha » Sun May 13, 2012 12:59 pm

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.
sdmaha
 
Posts: 5
Joined: Thu Apr 26, 2012 4:42 am

Re: Calling PdfUtil.PrintFile throws an exception

Postby pbne04 » Mon Jul 23, 2012 12:52 pm

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
pbne04
 
Posts: 2
Joined: Mon Jul 23, 2012 12:33 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

cron