Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print a PDF document
Message
 
To
20/10/2005 10:07:29
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 1.1
OS:
Windows 2000
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01054404
Message ID:
01060745
Views:
21
Sorry, I have no clue on this.

>Hi Eric,
>
>This works fine using a windows or console app, but does not work from an aspx page. Any idea how to print from an aspx web page? I'm trying to print the pdf to the client's default printer. The pdf is created on the application server using remoting and then I use another remote object to stream the bytes back to the web page. From there I save the bytes to a local copy of the pdf. I can display the pdf in a generic html control and the use can click the print button on the adobe toolbar, but I was looking for a way to automatically print without displaying the pdf and relying on the user to hit the print button.
>
>Any suggestions would sure be welcome.
>
>Thanks very much,
>
>Pat Moran
>
>
>>Try something like this:
>>
>>
>>	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
>>		Dim myProcess As Process = New Process
>>		'myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
>>		myProcess.StartInfo.FileName = "test.pdf"
>>		myProcess.StartInfo.Verb = "Print"
>>		myProcess.StartInfo.UseShellExecute = True
>>		myProcess.Start()
>>		myProcess.WaitForInputIdle()
>>		If myProcess.Responding Then
>>			myProcess.CloseMainWindow()
>>		Else
>>			myProcess.Kill()
>>		End If
>>	End Sub
>>
>>
>>>Hi Eric,
>>>
>>>No I haven't.
>>>
>>>Thanks,
>>>pat
>>>
>>>>Have you found an answer to that question ?
>>>>
>>>>
>>>>>Does anyone know how to print a PDF document from within .NET. I'm using a component PDFLib to create the PDF documents, but there is no methods for printing.
>>>>>
>>>>>I'm using something like this now:
>>>>>
>>>>> Process myProcess = new Process();
>>>>> myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
>>>>> myProcess.StartInfo.FileName = "test.pdf"
>>>>> myProcess.StartInfo.Verb = "Print";
>>>>> myProcess.StartInfo.UseShellExecute = true;
>>>>> myProcess.Start();
>>>>>
>>>>>This seems to work ok, but it leaves Acrobat.exe running in the background. I see it in the task manager as a process. How do I close the process after a PDF document prints?
>>>>>
>>>>>This code is in a business object. I have a business tester form that allows me to test the methods of the business object. When the business object is hosted in a Windows service (the object is remoted), I get no errors, but I also get no documents, even though the logs show that the document printed. We have text logging in our bussiness objects to help with debugging.
>>>>>
>>>>>Any help would be appreciated.
>>>>>
>>>>>Thanks very much,
>>>>>Pat Moran
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform