나는 내 바퀴를 돌리고 있습니다. vb.net을 사용하는 asp.net 사이트가 있습니다. 인트라넷 SharePoint 페이지를 통해이 ASP.net 사이트에 연결됩니다. SSRS 보고서에서 pdf 파일을 생성하는 코드가 있습니다. 이제 같은 코드 줄에서 pdf 파일을 인쇄하고 싶습니다. 나는 이것이 작동하지만 운이 좋지 않다는 것을 알았습니다.버튼을 클릭하십시오. 서버에서 PDF 인쇄를 클릭하십시오.
''''PRINT REPORT
''get default printer
Dim oPS As New System.Drawing.Printing.PrinterSettings
Dim defaultprintername As String = ""
Try
'Set my print ---- defaultprintername = "Dell 3330dn Laser Printer XL"
defaultprintername = oPS.PrinterName
Catch ex As System.Exception
defaultprintername = ""
SendAllLabel.Text = "ERROR - Could not set printer"
Finally
oPS = Nothing
End Try
Dim pathToExecutable As String = "AcroRd32.exe"
Dim starter As New ProcessStartInfo(pathToExecutable, "/t " + strReportOutput + " " + defaultprintername + "")
Dim Process As New Process()
Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
Process.StartInfo.UseShellExecute = True
Process.StartInfo.Verb = "print"
Process.StartInfo.CreateNoWindow = True
Process.StartInfo = starter
''WILL NOT START BUT NO EXCEPTION
Try
Process.Start()
Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
Catch ex As System.Exception
SendAllLabel.Text = "ERROR - Could not set print job."
End Try
System.Threading.Thread.Sleep(30000)
Process.CloseMainWindow()
Dim iLoop As Int16 = 0
'check the process has exited or not
If Process.HasExited = False Then
Try
Process.Kill()
Catch ex As Exception
SendAllLabel.Text = "ERROR - Could not stop process."
End Try
'if not then loop for 100 time to try and close the process'with 10 seconds delay
While Not Process.HasExited
System.Threading.Thread.Sleep(10000)
Process.CloseMainWindow()
iLoop = CShort(iLoop + 1)
If iLoop >= 100 Then
Try
Process.Kill()
Catch ex As Exception
SendAllLabel.Text = "ERROR - Could not stop process."
End Try
Exit While
End If
End While
End If
Process.Close()
Process.Dispose()
Process = Nothing
starter = Nothing
이 기능을 사용하려면 어떻게해야합니까? 이 코드를 참조하는 사이트가 많이 있지만 그 이상의 내용은 아닙니다. 권한을 부여해야합니까? 그렇다면 어떻게해야합니까? 서버가 Adobe Reader 10.0을 사용하고 대부분의 사용자가 Reader 11.0을 사용 중입니다.
하십시오 당신에게 내가 나이 전에 쓴
당신은 PDF를 생성 한 후 브라우저로 아래로 스트리밍 할 필요가
ASP 코드로 인쇄하라는 메시지가 나타나면 클라이언트 컴퓨터가 아닌 서버에서 인쇄하도록 요청하는 것입니다. 맞습니까? – Steve
새 웹 브라우저에서 PDF를 열면 인쇄 옵션이 제공됩니다. 이것으로 충분하겠습니까? – voddy
서버의 기본 프린터는 클라이언트를 위해 이동해야하는 프린터입니다. – Schwimms