DllHost.exe error when trying to print a PDF

Posted by: d.christ on 5 May 2019, 7:04 pm EST

  • Posted 5 May 2019, 7:04 pm EST

    Hi,

    i use C1PdfDocumentSource to print out an existing PDF file from disk. This worked for a while and is still working on other test machines. But it has started to crash the "COM Surrogate" (DllHost.exe) process on the production machine.

    The machine in question where this happens is a Windows Server 2012 R2. We use .NET 4.7.1 with Visual Basic.

    This is the simple code i am using:

    Using doc As C1.Win.C1Document.C1PdfDocumentSource = New C1.Win.C1Document.C1PdfDocumentSource()

    Dim pSettings As Printing.PrinterSettings = New Printing.PrinterSettings With {
    .PrinterName = "Printer Name"
    }

    Try
    doc.LoadFromFile("test.pdf")
    doc.Print(pSettings)
    Catch ex As Exception
    MessageBox.Show(ex.Message, "PDF Print", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
    End Using


    What would cause this error and is there a way to workaround this? Also is this the recommended way to print out PDFs with Component One?
  • Replied 6 May 2019, 6:36 pm EST

    Hi,

    Thank you for sharing the code snippet.
    Yes, you are printing the pdf the recommended way.

    To test the issue you are facing, I ran the *.exe of the application with your code snippet in Win2012ServerR2 machine but the issue did not come over there. I used the latest ComponentOne version 4.0.20191.363 version, what version are you using?
    1. Can you try to re-print the pdf using the latest version, that can be downloaded from here: http://prerelease.componentone.com/dotnet40/c1winforms/2019-t1/C1WinForms.4_4.0.20191.363.zip

    2. Could you also check if the issue comes over other machines as well or is it specific to Server machine only?
    If yes, can you share the pdf you are trying to print and facing issues!

    3. If the issue is specific to Server machine, do you have a real-printer installed over there?

    Once we have these information, we'll be able to help you better in resolving the issue.

    Thanks,
    Ruchir
  • Replied 6 May 2019, 10:51 pm EST

    I am using version 4.0.20183.338. Tried with the version you linked and it let to the same result.

    So i did a few more tests.

    I was thinking it was in this specific machine only, but now it seems to be tied to a specific printer. On other machines i was using "FreePDF" or "Microsoft Print to PDF" printer drivers, which was always working. On the production machine there is a label printer by Zebra (Modell GX430t). When i print to this the error always occurs. Printing to "FreePDF" works there too.

    The pdf file used does not seem to matter. I attached one pdf where this error happened.

    The label printer uses the windows driver by Zebra Version 5.1.16.6927 (EPL). If that matters.
  • Replied 6 May 2019, 11:33 pm EST

    C1PdfDocument.zip
  • Marked as Answer

    Replied 8 May 2019, 8:50 pm EST

    Hello,

    Thanks for the information. I could not observe the issue with your PDF file.
    I would like you to test if the same printer works fine when you use this PDF and print it using MS controls or other controls.
    The error seems to be unrelated to ComponentOne controls and thus, I would like you to go through the following posts:
    https://social.technet.microsoft.com/Forums/Lync/en-US/38f21000-fbd3-4cc9-ac18-2de3c618fb75/com-surrogate-has-stopped-working?forum=win10itprogeneral
    https://devblogs.microsoft.com/oldnewthing/20090212-00/?p=19173

    Thanks.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels