Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print pdf from asp.net

Status
Not open for further replies.

nooro

Programmer
Feb 7, 2003
22
0
0
GB
I'm having terrible trouble printing pdf files from asp.net. I think I've got it most of the way, using the System.Diagnostics.Process class to call on acrord32.exe with the relevant parameters to print the file.

The only trouble I seem to be having is, when I make the call, I get a file not found error every time. I have specified the full path to the file I need to print, and verified the file exists there time and again. I see this behaviour on two seperate systems. I think it must be a facet of having to open the acrord32 thread in the context of the ASPNET account.

Any suggestions??
 
It could be that even though the file may exist (the file system has put a file there with a name), the pdf generation isn't actually complete, and therefore the file isn't actually there yet.

I remember a few projects back we did pdf generation through a java application from asp.net.

We had to make the thread sleep until we for sure knew that the file was there and the java app had released its hold on the file.

Maybe try that and see if it helps (although you mentioned that the file is already there for sure from your code, right?)

My guess would be its some sort of timing issue anyway.

hth

D'Arcy
 
Thanks for the reply, however :

At the point of calling the Start method, the pdf will definately be stored on disk. Also, I've knocked up a quick c# console app, with the exact same line of code, which works fine (it executes in my current user context).

I can get as far as putting a job in the print queue (which fails) if I call the Process.Start as a static method. But the job has a zero file size (file's not there!?). Interestingly, if I purposefully specify a file which I know doesn't exist, it wont even submit a print queue job.

This would lead me to assume it to be an issue with the ASPNET accounts permission on the file system if it weren't for two things :

i, I'm getting a file not found error, not a permission denied which is a definate discrete error condition

ii, The ASPNET account has previously written to the filesystem with no problems. Indeed it's this and similar processes which create the pdfs in the first place.

I'm practically out of ideas ^_^

*tears hair out*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top