|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
Hi,
I wonder if your PDF control supports printing from a Windows service (without requirement of having Acrobat installed)?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
Yes. EO.Pdf does not rely on any external components such as Acrobat to print and it can print without the print dialog. So you should be able to print from service fine.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
So, currently I own license for EO.WebBrowser (single developer) which expires in May. I intend to renew but I am interested in PDF package as well. Do you have any offer for me to go to EO.Total or discount on PDF?
Feel free to email me as well. Thanks
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
So, I tried the trial and I was able to print when running in Windows Forms mode. When running from Windows service nothing happened at all. I am not sure if it was due to that I am running trial or if there is a generic problem with printing from Windows services. No error was raised.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, This should not have anything to do with trial mode. Did you turn off the print dialog? You will need to explicitly pass a printerSetting argument in order to turn the print dialog off. See here for more details: https://www.essentialobjects.com/doc/eo.pdf.pdfdocument.print.aspxThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
Yes, I passed the right object. No printer dialog in winforms either.
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
Here is the code:
Code: Visual Basic.NET
'Create objects for printer and page settings and PrintDocument
Dim ps As New System.Drawing.Printing.PrinterSettings()
Dim pgs As New System.Drawing.Printing.PageSettings()
pgs.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)
Select Case psc.PageSettings.PaperOrientation
Case EnmOrientation.Landscape
pgs.PrinterSettings.DefaultPageSettings.Landscape = True
Case EnmOrientation.Portrait
pgs.PrinterSettings.DefaultPageSettings.Landscape = False
End Select
' print range
Select Case psc.PrintRange
Case EnmPrintRange.AllPages
' do nothing
Case EnmPrintRange.CurrentPage
pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.CurrentPage
Case EnmPrintRange.Selection
pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection
Case EnmPrintRange.SomePages
pgs.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection
End Select
' add support for printing specific pages
If psc.SelectedPages IsNot Nothing Then
Dim selectedPages As String = GetSelectedPages(psc.SelectedPages)
Dim pages() As String = selectedPages.Split(",".ToCharArray)
End If
'Set printer name
ps.PrinterName = psc.SelectedPrinter
'Set PageMargins (if required)
ps.DefaultPageSettings.Margins.Left = 0
ps.DefaultPageSettings.Margins.Right = 0
ps.DefaultPageSettings.Margins.Top = 0
ps.DefaultPageSettings.Margins.Bottom = 0
' copies
ps.Copies = psc.NoOfCopies
Dim pdfdoc As New PdfDocument(psc.File, psc.Password)
Dim mt As EO.Base.ManualTask = pdfdoc.Print(ps, pgs)
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
Just checking again if you could reproduce this by creating a snippet like this in a Windows service. This is the only thing preventing me from buying the product.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
Yes. We can reproduce it here. We still do not know the root cause though. We will reply here once we have any update.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, We have found the root cause of the issue in our test environment to be that there is no default printer for the service account. You may have other similar issues on your system, but you can try to handle this event and see if you catch anything: https://www.essentialobjects.com/doc/eo.base.runtime.exception.aspxIn our environment this event will catch the no default printer exception. We have also found that in case of such an exception, the internal WebView will be destroyed and the ManualTask returned by the Print method will not be signaled. This would cause a hang if you have code wait on this task. This issue will be fixed in our next build. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
Hi,
how come the default printer is interesting when I explicitly specify a printer that it should use?
I will not be able to test this for about a week as I going away.
thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
This is the reason on our test computer ---- your exactly reason can be different. This is why we suggested you to handle the EO.Base.Runtime.Exception event to see if you catch any exceptions that would tell you more details about what went wrong.
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
I tried to add the handler now: Quote: AddHandler EO.Base.Runtime.Exception, AddressOf EOException However, no errors is thrown. It just don't print. How can we move forward with this?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
It does print out fine here. Please update to the .55 build first, this build added additional error handling code.
If that still does not work, if possible, you can provide us RDP access to your test system and we can try to debug on it to see if we can find anything. Other than that I am not sure what else we can do since we can not reproduce it here.
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
Built with latest 0.55. But the Exception event is never called. The question is if it even confirms sending to the spooler?
How would debugging really work? Because this can only be debugged in a running process (as Windows service). Of course we can send you the link to the executable of our exe but I am not sure how you will debug this?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
We won't be using your service ---- we just need your computer because the issue can't be reproduced in our environment. We will create our own test service and upload test build of our DLL with additional logs at places where we suspect that can go wrong to your server to see what we can find. This process will repeat many times until we can eventually find out what went wrong. So it will be a long process.
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
As I need access to the computer do you think you could send an executable I could run and then send you the results?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
That would not be practical. We will need unattended access to your test environment for this kind of issues. The reason is we have no idea of where the problem is and this can take many iterations. We may also need to launch debugger on the machine to examine run time information (call stacks, memory locations) etc. This can not be done effectively by shipping files back and forth.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 5/9/2016 Posts: 84
|
Ok, I will try to create a virtual environment and get back to you. Where should I send the details?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, You can either send us through private message or email us. See our email address here: https://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|