Export PDF as MemoryStream

Posted by: hanson.h.fong on 4 October 2022, 10:35 pm EST

    • Post Options:
    • Link

    Posted 4 October 2022, 10:35 pm EST

    I am using trial license to try the features, and I have encountered an issue when I tried to implement the Azure Functions with exporting PDF to Blob storage.

    pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);

    When the above code executed, there is an exception message.

    “This application will be terminated because it was built without a license for PageReport.”

    Here is my full code below:-

    var outputProvider = new GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider();
    
    var pageReport = new GrapeCity.ActiveReports.PageReport(new FileInfo(localFilePath));
    var pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
    var pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
    pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);
    
    using (var fileStream = (MemoryStream)outputProvider.GetPrimaryStream().OpenStream())
    {
    	await blockBlob.UploadFromStreamAsync(fileStream);
            responseMessage = blockBlob.Uri.ToString();
    }
  • Posted 6 October 2022, 6:31 am EST - Updated 6 October 2022, 6:39 am EST

    Hello,





    In order to license a project which utilizes the azure function, please try creating a gclicx file, and adding the same in the given project as an ‘Embedded Resource’. You may use the below-specified command to generate the same:

    gclm.exe "5e0b5f44-1a6b-4aff-a007-17b9224bca83" -lc .\.gclicx Microsoft.Azure.WebJobs.Script.WebHost.[assembly name].dll

    For more information on the same, please refer to the below link:

    https://www.grapecity.com/activereportsnet/docs/latest/online/licensing-compiled-code.html





    Also, Please add the following line in the csproj file to disable the generating the license:

    <DisableGclm>True</DisableGclm>

    Regards

    Dushyant Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels