ABCPDF6 issue: "HTML render is blank" but web page output is fine
Asked Answered
C

3

9

Like the title says, we are using ABCPdf6 to render PDFs from XSLT. Everything was working fine, but now we are getting an error that states "HTML render is blank". Using a browser (tested on IE/Firefox/Chrome) I am able to browse to the generated HTML (formatted XSL) and it displays perfectly fine in the browser. ABCPDF6 is not able to convert the file. I have tried giving control to the page that outputs the XSL, but I am still getting this error.

Does anyone have experience with ABCPdf and have encountered this before? The code was working fine before without a problem, and another page that uses the exact same generating code (even pointing to the same placeholder page that spits out the HTML!) is working fine.

Chromaticness answered 4/10, 2011 at 19:59 Comment(3)
I have the exact same problem, have you been able to resolve this? I am almost certain that this problem occured after we ran Windows update on our 2008 server.Sakti
As it turns out, the issue was totally unrelated to ABCPDF. I have no idea why this problem occurred. Sorry I cannot be of more help to you.Chromaticness
#5301220 this fixed the same issue for me.Bader
S
16

I know what the problem was in my case now. When i ran Windows update on my 2008 server, Internet Explorer 9 was installed. IE 9 has a different way of rendering HTML which brakes abcPDF. Updating to the latest version (8) solved all my problems. In this version you can also try another HTML engine called Gecko.

Even though you have resolved your problem, if anyone else gets this error, I would suggest that you install the trial version and try this out with the latest version.

Sakti answered 20/10, 2011 at 13:28 Comment(2)
I'm assuming you mean abcPDF version 8, not IE version 8. Also, fun trivia: Gecko is the Mozilla renderer, so it should be similar to Firefox. :)Reputed
is there any way to fix the issue without Gecko rendering engine? We have ABCPdf built-in as third-party component in some software, and this issue just pisses me off, since I cannot directly change anything there. ABCPdf sucks.Cristionna
Z
3

I had same error on windows 7 machine with AbcPdf4.0. During MS updates IE8 was upgraded to IE10. Issue got fixed by uninstalling IE10.

Note: Abcpdf4.0 does not work with IE9 onwards. Either upgrade Abcpdf or uninstall latest IE.

Zenger answered 30/8, 2013 at 9:52 Comment(0)
I
1

I had a similar issue this morning with AbcPdf9. I added code to test the engine types and GECKO worked, then I swapped it back to MSHTML, and it still worked. So it was a temporary issue.

This is how you specify the engine type:

using (var document = new Doc())
{
    document.HtmlOptions.Engine = EngineType.Gecko;
    ...
    ...
}

This code calls the method that converts the html to PDF, but calls it twice if necessary, since it will only fail once:

try
{
    return GeneratePdfFromHtml(html, width, EngineType.MSHtml);
}
catch (Exception ex)
{
    /* detect this known issue, swapping the rendering engine once seems to fix it */
    if (ex.Message.ToUpper().Contains("BLANK"))
    {
        return GeneratePdfFromHtml(html, width, EngineType.Gecko);
    }
    throw;                            
}

Then you can add a parameter to the method that does the conversion:

    public byte[] GeneratePdfFromHtml(string html, int width, EngineType engineType)
    {
        if (string.IsNullOrWhiteSpace(html)) throw new ArgumentNullException("html");
        if (width < 100) throw new ArgumentOutOfRangeException("width");

        try
        {
            using (var document = new Doc())
            {
                document.HtmlOptions.Engine = engineType;
                ...
                ...

If you have a suggestion or different solution, please leave a comment.

Intensifier answered 19/9, 2014 at 6:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.