Question

Hello I have the following code and I am trying to convert a html page into a pdf. I am using abcpdf.

My code is below :

Doc theDoc = new Doc();
    theDoc.Rect.Inset(72, 144);

    theDoc.Page = theDoc.AddPage();
    int theID;
    **theID = theDoc.AddImageUrl("http://www.templateworld.com/free_templates.html/");**

    while (true)
    {
        theDoc.FrameRect(); // add a black border
        if (!theDoc.Chainable(theID))
            break;
        theDoc.Page = theDoc.AddPage();
        theID = theDoc.AddImageToChain(theID);
    }

    for (int i = 1; i <= theDoc.PageCount; i++)
    {
        theDoc.PageNumber = i;
        theDoc.Flatten();
    }

    theDoc.Save(Server.MapPath("pagedhtml.pdf"));
    theDoc.Clear();

At the following line :

theID = theDoc.AddImageUrl("http://www.templateworld.com/free_templates.html/");

it throws an error saying "HTML render is blank". I tried the same on Firefox and chrome too. I tried using other urls too. I get the same error.

Anyone know of any solution to this problem ?

Était-ce utile?

La solution 2

Both the answers by trueamerican420 and McAden really helped.

I am using ABCPDF version 7 on Internet explorer 10. I removed the update and downgraded to internet explorer 9. and everything works perfectly now

Autres conseils

Check out this other Stack Overflow article. Maybe it will help you out.

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top