Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone been able to get ABCPDF (HTML Conversion) working on azure websites

Webforms Page Code behind

        XSettings.InstallRedistributionLicense("REDACTED");
        var theDoc = new Doc();
        theDoc.HtmlOptions.Engine = EngineType.Gecko;
        theDoc.Rect.Inset(72, 144);
        theDoc.Page = theDoc.AddPage();
        int theID = theDoc.AddImageUrl("http://www.woot.com/");
        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();
        }
        Response.Buffer = false;
        Response.AddHeader("Content-Disposition", "inline; filename=\"rept.pdf\"");
        Response.ContentType = "application/pdf";
        theDoc.Save(Response.OutputStream);
        Response.Flush();

should work pretty well.. but get

      Failed to add HTML: RPC to Gecko engine process failed.Remote process terminated unexpectedly.

Running Full trust have in bin folder

  • XULRunner Folder and everything from C:\Program Files (x86)\WebSupergoo\ABCpdf .NET 9.0\ABCGecko
  • ABCGecko.dll
  • ABCpdf.dll
  • ABCpdf9-32.dll

Package / Publish Web All files in this project folder

like image 796
MarkKGreenway Avatar asked Nov 29 '12 17:11

MarkKGreenway


2 Answers

You are not allowed to run external processes from within your Windows Azure Website as this would pose a risk in the shared infrastructure.

See this post by a MSFT employee or that post where the same employee talks about other restrictions concerned with native APIs.

You can verify that the problem is related to the externally launched Gecko by not adding the HTML image to the document. For me the creation of the PDF progressed further but failed because of the missing license.

It looks like you would have to find a fully managed/.NET HTML rendering engine (if converting a website to PDF is your use-case) or hope that reserved-mode web sites gain the right to execute native/external processes.

like image 150
Simon Opelt Avatar answered Nov 17 '22 14:11

Simon Opelt


There are full ABCpdf Azure deployment guides here:

http://www.websupergoo.com/support-azure-abcpdf.htm

like image 2
OnceUponATimeInTheWest Avatar answered Nov 17 '22 13:11

OnceUponATimeInTheWest