Welcome Guest Search | Active Topics | Sign In | Register

PDF printing from Windows service Options
serializer
Posted: Wednesday, January 3, 2018 5:16:26 AM
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)?
eo_support
Posted: Thursday, January 4, 2018 11:30:30 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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!
serializer
Posted: Thursday, January 4, 2018 11:38:42 AM
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
serializer
Posted: Friday, January 5, 2018 5:44:23 AM
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.
eo_support
Posted: Friday, January 5, 2018 9:51:40 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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.aspx

Thanks!
serializer
Posted: Friday, January 5, 2018 9:54:44 AM
Rank: Advanced Member
Groups: Member

Joined: 5/9/2016
Posts: 84
Yes, I passed the right object. No printer dialog in winforms either.
serializer
Posted: Saturday, January 6, 2018 10:02:01 AM
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)
serializer
Posted: Wednesday, January 10, 2018 2:55:37 AM
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.
eo_support
Posted: Wednesday, January 10, 2018 7:15:07 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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!
eo_support
Posted: Thursday, January 11, 2018 2:23:12 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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.aspx

In 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!
serializer
Posted: Thursday, January 11, 2018 3:54:00 PM
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
eo_support
Posted: Thursday, January 11, 2018 4:13:59 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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.
serializer
Posted: Friday, January 19, 2018 7:03:27 AM
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?
eo_support
Posted: Friday, January 19, 2018 7:56:11 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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.
serializer
Posted: Friday, January 19, 2018 9:09:45 AM
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?
eo_support
Posted: Friday, January 19, 2018 9:49:45 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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.
serializer
Posted: Friday, January 19, 2018 10:01:03 AM
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?
eo_support
Posted: Friday, January 19, 2018 11:08:27 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
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!
serializer
Posted: Friday, January 19, 2018 11:31:22 AM
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?
eo_support
Posted: Friday, January 19, 2018 1:08:12 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

You can either send us through private message or email us. See our email address here:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.