codaxy / wkhtmltopdf

C# wrapper around excellent wkhtmltopdf console utility.
265 stars 92 forks source link

Exception: Pipe has been ended. #13

Closed fean closed 7 years ago

fean commented 8 years ago

Because of environmental limitations I can only see the exception message.

As stated in the title it says: Pipe has been ended.

This is the code I used:

            var stream = new MemoryStream();
            PdfConvert.ConvertHtmlToPdf(new PdfDocument()
            {
                Html = ret_invoice,
                ExtraParams = new Dictionary<string, string>()
                {
                    { "page-size", "1440" }
                }
            }, new PdfOutput()
            {
                OutputStream = stream
            });

I looked around on the internet and most times when this happened the C++ 2013 redistributable wasn't installed in the environment. I had already installed it before hand so that's not the cause. Also I tried to use both x86 and x64 versions of wkhtmltopdf.exe and they both worked fine.

Command I used to test wkhtmltopdf.exe: wkhtmltopdf "http://tweakers.net" C:\test_pdf.pdf

mstijak commented 8 years ago

I cannot reproduce this. Are you using the latest version of wkhtmltopdf?

radek-dab commented 8 years ago

I had the same problem. IOException was thrown at line stream.BaseStream.Write(buffer, 0, buffer.Length);.

I've noticed that It works when Url is set to "-". It's confusing.

fean commented 8 years ago

Yes, that's why I tried to make a pull request concerning certain problems with the package. Sadly the repo owner doesn't respond anymore :/

If you want a more modern approach to the same package you can get it from: https://github.com/AuthiQ/wkhtmltopdf

Good luck! :)

PepijnI commented 6 years ago

I also ran into this problem, and C++ 2013 redistributable did't fix it for me. After installing the Microsoft Visual C++ Redistributable for Visual Studio 2017 x86 and x64 it worked for me!

cbonezzi commented 5 years ago

Do we know why Visual C++ Reds for Visual Studio 2017 x86 and x64 worked? I am facing the issue presented above, and I do have Visual C++ 2013 reds installed, but the issue still present.