tuespetre / TuesPechkin

A .NET wrapper for the wkhtmltopdf library with an object-oriented API.
326 stars 116 forks source link

Convert methods hangs sometimes. #172

Open pankajmalhotra09 opened 6 years ago

pankajmalhotra09 commented 6 years ago

Hi,

I am using TuesPechkin v2.0.50727 in a web application hosted on IIS. I have created a static class for converter. To generate a PDF file I am only passing the document details to the convert method written in my static class. But sometimes tuesPechkin hangs while generating a PDF file. In such cases IIS reset is required to start generating PDF again. I have also observed that the html file for which tuesPechkin hangs is coped to the temp folder with name "wktemp-*" but not converted. When a file is converted to PDF, the html file is deleted from temp folder and only PDFfile is present.

Following code is used to create the static class.

public static class PeckinConvertor { private static IConverter converter = new ThreadSafeConverter( new RemotingToolset( new Win32EmbeddedDeployment( new TempFolderDeployment())));

    public static byte[] Convert(HtmlToPdfDocument document)
    {
        byte[] result = new byte[1];
            lock (converter)
            {
                var tmp = new TuesPechkin.TempFolderDeployment();
                result = converter.Convert(document);
            }
        return result;
    }

}

In order to generate the PDF I am creating a document object and passing it to the convert method of the static class. This issue is very random in nature. Sometimes it work perfectly for weeks and sometimes I face this issues on daily basis.

Please help me resolve this issue. Thanks in Advance

ghost commented 6 years ago

Hello,

We have the same issue with TuesPechkin on the IIS environment - the Convert method hangs randomly and just recycling the App Pool resolve the issue. This is happening usually after a code deploy.

Do you have any workaround for this?

Thank you, Ion

tloy1966 commented 6 years ago

Did you try unload RemotingToolset?

vsarunov commented 5 years ago

@tloy1966 using unload it will crash the application after second request when trying to convert.

jackiemanzzz commented 5 years ago

@vsarunov did you find any solution for hanging or crash?

vishalpandeyknp commented 4 years ago

I am also facing the same problem.