Question

We have a requirement for PDF generation on the fly in our .NET Azure application, and have determined that PDFLib best meets our requirements.

Basic deployment is dll based, and so should be relatively straightforward. While researching the issue, I came across a case-study covering installation of another, similar component (AbcPdf, here), and this led me to wonder if anybody had any similar detailed experience to share regarding getting PDFLib up and running on a cloud service?

Specifically, I'm interested in whether there are any files other than the referenced .dlls which have to be copied with the package, whether I need to install PDFLib to the GAC using a startup command, and if there are any issues getting licensing working in a cloud environment.

We could of course use a VM for this if required, but initially I am looking to use a standard worker role. I am going to ask PDFLib support this question and will share any answer I get here, as I haven't found this topic covered anywhere else on Stackoverflow.

Was it helpful?

Solution

This is what I got back from PDF Lib support, which I think covers everything:

Does the .NET PDFLib require GAC deployment, or can the dlls simply be copied to the server?

you can simple deploy the pdflib_dotnet dll.

Are there any files other than the referenced dlls which need to be deployed for PDFLib to work?

no, PDFlib do not have any further dependencies.

How can we authenticate our product license in an environment where we may not be able to run an installer, and where we may not have access to the windows registry?

there are multiple ways to to this. The most simple way is to apply the license key in the code. You can also apply a licensefile. Please get in mind, you need for each serve, where PDFlib run in production usage a separate license. For example, when you run the application in a cluster system with 4 nodes (servers), you need 4 licenses.

And, do you have any general guidance on cloud deployments such as this?

we do not have any special comments on this. But I'm sure, you will find a lot of relevant information about the concepts of our PDFlib .NET implementation in the "PDFlib in .NET Howto", which is included in the PDFlib 8 package, and also available on our website: http://www.pdflib.com/en/developer/technical-documentation/pdflib-in-net-howto/

OTHER TIPS

Let me start with I've not deployed this compment into Azure; however, what follows should be accurate for just about any component you have.

If you can just xcopy deploy this component to a regular server it should just work with a normal deployment package to a Cloud Service; however, if there is an install that is required when you distribute to normal servers (read, NOT your development machine), then you may have some extra steps here. For example, if the install pushes the assembly into the GAC, then you'd have to follow suit.

I'd simply test an xcopy deployment rollout to a regular on premises box that hasn't had an installation of this component before and see if it works. If it does, you're likely just fine to ensure it gets referenced and deployed with your package. If you are concerned that it may need other assemblies to go with it, use something like Reflector, Just Decompile or ILDasm to check out the references the assembly has (careful, using a decompiler on the assembly may be against your EULA).

I know you're asking for actual experience, but I'd say the answer is that this should just work. From http://www.pdflib.com/fileadmin/pdflib/pdf/support/PDFlib-in-.NET-HowTo.pdf:

A process called xcopy deployment is also supported. You can simply copy the PDFlib assembly (pdflib_dotnet.dll) to the server using the xcopy command or FTP transfer

I downloaded and PDFLib x64 version and a give a quick try with Windows Azure Web Role. The Library contains only one DLL as PDFlib_dotnet.dll which you can add as reference and set its property "Copy Local As True". After that you can just reference it in your code and use it based on documentation.

Based on my quick test, you really need to modify the code to use Windows Azure Local Storage to create your PDF files and the sync to Windows Azure Blob storage to persist it properly. There may be way to create the PDF directly to Azure Blob storage but I just did not look further.

I created an ASP.NET based webrole with the following code:

        PDFlib p;
        int font;

        p = new PDFlib();

        try
        {
            // This means we must check return values of load_font() etc.
            p.set_parameter("errorpolicy", "return");

            // Added code to create PDF on Local Storage 

            LocalResource myStorage = RoleEnvironment.GetLocalResource("myLocalStorage");
            string filePath = Path.Combine(myStorage.RootPath, "hello.pdf");


            if (p.begin_document(filePath, "") == -1)
            {
                Console.WriteLine("Error: {0}\n", p.get_errmsg());
                return;
            }

            p.set_info("Creator", "hello.cs");
            p.set_info("Author", "Rainer Schaaf");
            p.set_info("Title", "Hello, world (.NET/C#)!");

            p.begin_page_ext(595, 842, "");

            font = p.load_font("Helvetica-Bold", "unicode", "");
            if (font == -1)
            {
                Console.WriteLine("Error: {0}\n", p.get_errmsg());
                return;
            }

            p.setfont(font, 24);
            p.set_text_pos(50, 700);
            p.show("Hello, world!");
            p.continue_text("(says .NET/C#)");
            p.end_page_ext("");

            p.end_document("");
        }

        catch (PDFlibException eX)
        {
            // caught exception thrown by PDFlib
            Console.WriteLine("PDFlib exception occurred in hello sample:\n");
            Console.WriteLine("[{0}] {1}: {2}\n", eX.get_errnum(),
                    eX.get_apiname(), eX.get_errmsg());
        }
        finally
        {
            if (p != null)
            {
                p.Dispose();
            }
        }
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top