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

2

11

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

Jugum answered 29/11, 2012 at 17:20 Comment(6)
removed all references and files... added nuget package nuget.org/packages/ABCpdf.ABCGecko still no luckJugum
there is a case study on the abcpdf site using worker roles not sure if you could utilise that perhaps websupergoo.com/abcpdf-windows-azure-altaine.htmCutwater
not really . worker roles have worked the whole time...still get errors gist.github.com/hurricanepkt/6021781 source demo abcpdf.azurewebsites.net (right side is the source). Microsoft has acknowledged this as a bug and were fixing it.Jugum
did they say this somewhere?Cutwater
In a private email to me from the dev teamJugum
I have used DocRaptor for my HTML to PDF conversions for Azure websites. Their model is not optimal but it works on Azure. You POST your HTML to their site and they respond with the PDF. It is great if you need to do a few PDFs, but if you have high volume the pricing model falls over in favor of other methods.Unlicensed
S
7

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.

Salonika answered 4/12, 2012 at 23:16 Comment(1)
This is out of date. Azure in 2012 is completely different from Azure now. Indeed the Windows Azure Website product doesn't exist any more. What exists now in 2017 is called an App Service and there are a variety of different flavors including a Web App one. Web Apps are cut down VMs, simple to use but restricted in control and funtionality. There are also Cloud Services which are a whole lot more powerful and also offer web services. Finally there are full featured Virtual Machines. See: cloudacademy.com/blog/…Eocene
E
2

There are full ABCpdf Azure deployment guides here:

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

Eocene answered 6/3, 2014 at 17:24 Comment(5)
thanks for the info... seems like it still won't work directly with windows azure websitesJugum
It works on Azure. Just follow the deployment guide listed above.Eocene
Looks like it still does not allow HTML conversion. Will edit the title to add detailJugum
This doesn't work with Azure App service , as the date i am posting.Curricle
As of this date it does work. See the link above for details of Azure App Services etcEocene

© 2022 - 2024 — McMap. All rights reserved.